Jump to content
Macro Express Forums

Variable updates


MBone

Recommended Posts

here is the code.

 

Mouse Move Screen 1355, 190
Delay 2 Seconds
Get Pixel: Screen Coords: 1355,190 into %N11% 
If Variable %N11% = 0
 Text Type: <F1>
End If
Mouse Move Screen 962, 1031
Delay 4 Seconds
Mouse Move Screen 1355, 190
Get Pixel: Screen Coords: 1355,190 into %N11% 
Delay 4 Seconds 
If Variable %N11% <> 0
 Text Type: <F2><F3>
 Mouse Move Screen 918, 985
 Mouse Left Button Click
 Mouse Move Screen 918, 985
End If

 

Can some confirm this? When the command get pixel add new infomation to N11 if the old is overwrote or combined?

 

MBone

Link to comment
Share on other sites

here is the code.

 

Mouse Move Screen 1355, 190
Delay 2 Seconds
Get Pixel: Screen Coords: 1355,190 into %N11% 
If Variable %N11% = 0
 Text Type: <F1>
End If
Mouse Move Screen 962, 1031
Delay 4 Seconds
Mouse Move Screen 1355, 190
Get Pixel: Screen Coords: 1355,190 into %N11% 
Delay 4 Seconds 
If Variable %N11% <> 0
 Text Type: <F2><F3>
 Mouse Move Screen 918, 985
 Mouse Left Button Click
 Mouse Move Screen 918, 985
End If

 

Can some confirm this? When the command get pixel add new infomation to N11 if the old is overwrote or combined?

 

MBone

As rberq said, each time you set N11, the old information will be over-written by the new information.

 

As a side note, your code has some Mouse Move commands that may not be necessary (particularly the one after the Left

Button Click), and two 4 second delays separated by a Get Pixel command. If you really need it to wait 8 seconds,

you could clean the code up by changing the first 4 second delay to 8 seconds and then remove the 2nd delay.

 

Those are just observations, of course, since I don't know what your macro is doing beyond the scope of this code, and

these actions may be necessary.

Link to comment
Share on other sites

Again, I don't know just what you are doing, but I am guessing the delays are to give the screen time to change. Another trick you can use, to find out when the screen has changed, is to use a repeat loop to check pixel color at a location that you know will change when the screen changes. That way the macro will automatically adapt to how fast your system is running on a particular day. The loop should have a delay coded inside it to give the system a realistic amount of time to change the screen.

 

For example:

// wait up to 10 seconds for screen change

get pixel color at x-coord, y-coord into N1

set N99=0

repeat 99999

add 1 to N99

if N99 > 100

display error text box "didn't change within 10 seconds"

macro end

end if

get pixel color at x-coord, y-coord into N2

if N2 <> N1

repeat exit (screen has changed)

else

delay 1/10 second

end if

repeat end

Link to comment
Share on other sites

... I am guessing the delays are to give the screen time to change. ...

 

If this is a webpage, the 'wait for page to load' command might be an option. Also note that if the 'title' of the active window changes, then that might be useful too.... -sk

Link to comment
Share on other sites

If this is a webpage, the 'wait for page to load' command might be an option. Also note that if the 'title' of the active window changes, then that might be useful too.... -sk

 

the delays are for my visual clues to where i am getting my information. I some times use the computer during the macro runs and need to know when to leave it be and when i can use it.

 

This topic came from getting an error from a pixel (macro was doing correct and i didnt account for it) where i had a rotating icon. It would cycle over where i need to get the pixel info and i didnt think it was doing that. I added "and" to the check with 2 ms apart and fixed the problem.

 

Correct me if i am work for doing this way but i use this program by breaking things down into logic mods and macro mods. Just to clear up things as i tend to be a little back country typer. Logics are macros that get variables to decide what macro to do next. Currently i have it doing what i need to but not the most efficient way. And i need a little bit of information.

 

since i am doing the break down of mods do the variable i set stay, for example N10 on one of the macros stay that way until they are overwritten or do they clear after step has been complete. I will try to draw this out.

 

Macro Run: username/password

 

Delay 30 Seconds

 

Macro Run: example one ...............(these are broken down further on each one) (N10 from here will or will not change)

 

Delay 30 Seconds

 

Macro Run: example two ...................................................(when this one starts)

 

Delay 30 Seconds

 

Macro Run: expample three

 

 

IF i need to reword it let me know.

 

Mbone

 

Or well i will do it now, For an example will N10 stay a set value until it is changed with an input or by variable set intenger?

Link to comment
Share on other sites

Not sure of the answer to your question. You could test it out by appending the current value to a text file in each macro, then look at the text file and see if it is changing.

 

To be sure of keeping the value from macro to macro, do Save All Variables at the end of each macro, and Restore All Variables at the beginning of each macro.

Link to comment
Share on other sites

Not sure of the answer to your question. You could test it out by appending the current value to a text file in each macro, then look at the text file and see if it is changing.

 

To be sure of keeping the value from macro to macro, do Save All Variables at the end of each macro, and Restore All Variables at the beginning of each macro.

 

Didnt know that command was there. I guess that will solve my work around. I was working my way up the numbers to keep from things crossing over. This should work out for what i need.

 

thanks

 

MBone

 

I will test it out and find out.

 

Hopefully will get enough of the test to find out tonight....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...