Jump to content
Macro Express Forums

Adding a counter to a loop repeater


MBone
 Share

Recommended Posts

Repeat until N1=34

Mouse move 123,123

Get pixel into N2

If var N2 >=1000

and

If var N2 <=1005

text type F2 F3

delay 60 seconds

else

delay 20 seconds

(What command do i put here)(this is where i want to put in the counter to add 1 every time it completes the macro)

end

repeat end

 

I have this macro running as intended but i want to add a loop and timer on it. I was reading last night and it says i can do it but i just dont know how to. To explain what i want is to add the macro counter on the ELSE part of the macro. So that it counts up to a certain number and then the loop will stop. I do understand that i have to put in "repeat width 1" so that i will get 01,02,03 etc... What i dont know how is the getting it from 01, 02 and so on.

 

The help on it was a little confusing.

 

also does anyone know what the PAUSE command it. I tried the "pause" and "Scroll lock" keys but it just kept going. The pause button really helps when testing out programs without having to what for the outside variable to happen.

 

thanks

 

MBone

Link to comment
Share on other sites

Repeat until N1=34

Mouse move 123,123

Get pixel into N2

If var N2 >=1000

and

If var N2 <=1005

text type F2 F3

delay 60 seconds

else

delay 20 seconds

(What command do i put here)(this is where i want to put in the counter to add 1 every time it completes the macro)

end

repeat end

 

I have this macro running as intended but i want to add a loop and timer on it. I was reading last night and it says i can

do it but i just dont know how to. To explain what i want is to add the macro counter on the ELSE part of the macro. So

that it counts up to a certain number and then the loop will stop. I do understand that i have to put in "repeat width 1" so

that i will get 01,02,03 etc... What i dont know how is the getting it from 01, 02 and so on.

 

The help on it was a little confusing.

 

also does anyone know what the PAUSE command it. I tried the "pause" and "Scroll lock" keys but it just kept going. The

pause button really helps when testing out programs without having to what for the outside variable to happen.

 

thanks

 

MBone

Add this code after the else (before or after the delay is up to you):

Variable Modify Integer: Inc (%N1%)

 

This command will increase N1 from whatever it started out as by 1. Once N1 = 34 your repeat will end (as indicated in

the Repeat Until command.

 

You'll probably also want to add a Variable Set Integer %N1% to 0 or 1 before beginning the repeat.

 

I hope this answers your question. If not, I misunderstood and would be happy to take another crack at it.

 

PS

 

The key combination for pausing your macro mid-run is going to depend on your preferences. You can check it by

selecting:

Options -> Preferences -> Playback

 

I have personally never found any use for the "pause" function like that. For debugging, I generally throw a Pause

Command into the macro itself or use a Text Box Display to help me locate trouble-spots, then once I'm convinced

the Macro is Working right, I either delete it, or de-activate that command (don't forget to save).

 

Based on the info in your post, I would build my macro to look like this:

 

Variable Set Integer %N1% to 1
Repeat Until %N1% = 34
 Mouse Move Screen 123, 123
 Get Pixel: Under Mouse into %N2%
 If Variable %N2% >= 1000
AND
 If Variable %N2% <= 1005
Text Type: <F2><F3>
Delay 60 Seconds
 Else
Delay 20 Seconds
Variable Modify Integer: Inc (%N1%)
 End If
Repeat End

Here's the direct editor script

<IVAR2:01:01:1><REP3:08:000001:000002:0001:0:01:34><MMS2:123,123><GETPXM:2><IFVAR2:2:02:5:1000><AND><IFVAR2:2:02:6:1005><TEXTTYPE:<F2><F3>><DELAY:60><ELSE><DELAY:20><NMVAR:08:01:0:0000001:0:0000000><ENDIF><ENDREP>

Link to comment
Share on other sites

Add this code after the else (before or after the delay is up to you):

Variable Modify Integer: Inc (%N1%)

 

This command will increase N1 from whatever it started out as by 1. Once N1 = 34 your repeat will end (as indicated in

the Repeat Until command.

 

You'll probably also want to add a Variable Set Integer %N1% to 0 or 1 before beginning the repeat.

 

I hope this answers your question. If not, I misunderstood and would be happy to take another crack at it.

 

PS

 

The key combination for pausing your macro mid-run is going to depend on your preferences. You can check it by

selecting:

Options -> Preferences -> Playback

 

I have personally never found any use for the "pause" function like that. For debugging, I generally throw a Pause

Command into the macro itself or use a Text Box Display to help me locate trouble-spots, then once I'm convinced

the Macro is Working right, I either delete it, or de-activate that command (don't forget to save).

 

Based on the info in your post, I would build my macro to look like this:

 

Variable Set Integer %N1% to 1
Repeat Until %N1% = 34
 Mouse Move Screen 123, 123
 Get Pixel: Under Mouse into %N2%
 If Variable %N2% >= 1000
AND
 If Variable %N2% <= 1005
Text Type: <F2><F3>
Delay 60 Seconds
 Else
Delay 20 Seconds
Variable Modify Integer: Inc (%N1%)
 End If
Repeat End

Here's the direct editor script

<IVAR2:01:01:1><REP3:08:000001:000002:0001:0:01:34><MMS2:123,123><GETPXM:2><IFVAR2:2:02:5:1000><AND><IFVAR2:2:02:6:1005><TEXTTYPE:<F2><F3>><DELAY:60><ELSE><DELAY:20><NMVAR:08:01:0:0000001:0:0000000><ENDIF><ENDREP>

 

 

thanks i will test it out and let you know. I knew the command was there but i could not find it or figure out away to implement it.

 

mbone

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...
 Share

×
×
  • Create New...