Repeat statement not working.
Moderators: JRL, Dorian (MJT support)
Repeat statement not working.
I went into the help and grabbed the example repeat until statement.
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Until>k,2
(changed the last var to a constant of 2 for testing)
I pasted it into the code window to see if even it would work and it doesnt.
I noticed that when I say %k% it types "k+1"
I guess it's handling the k=k+1 as a string instead of a math question.
Am I missing something to fix this?
Thanks for your help.
Let>k=0
Repeat>k
Let>k=k+1
Message>file_names_%k%
Until>k,2
(changed the last var to a constant of 2 for testing)
I pasted it into the code window to see if even it would work and it doesnt.
I noticed that when I say %k% it types "k+1"
I guess it's handling the k=k+1 as a string instead of a math question.
Am I missing something to fix this?
Thanks for your help.
I don't know what you mean by this.I noticed that when I say %k% it types "k+1"
Try these steps.
- Open the editor and paste in the code you have posted.
- Make sure there are no trailing spaces. I had one after the Until>k,2
- Make sure you place some blank lines after the last line
- Go to the "Tools" menu and make sure "Show Builder Pane" is checked
- Place the cursor at the top of the script, anywhere on the first line.
- Press the F8 key. F8 steps through the code one line at a time
- The builder pane on the left should now be displaying the "Watch List" where you can witness the variables as they change.
- The script should work flawlessly and you will be able to watch each step of the process.
This is my code below.
It doesn't stop after two loops.
and when I do "Send>%k%" it types "k+1"
there are no spaces that I can see?
CapsOff
Let>k=0
repeat>k
Let>k=k+1
MouseMove>1339,454
Wait>0.01
LClick
Wait>0.01
Press Backspace * 10
Wait>0.01
Send>2
Send>0
Random>9,DiceResult
Send>%DiceResult%
Random>9,DiceResult
Send>%DiceResult%
Random>9,DiceResult
Send>%DiceResult%
Wait>0.1
MouseMove>1293,491
Wait>0.01
LClick
Wait>3.41
MouseMove>1800,210
Until>k,2
It doesn't stop after two loops.
and when I do "Send>%k%" it types "k+1"
there are no spaces that I can see?
CapsOff
Let>k=0
repeat>k
Let>k=k+1
MouseMove>1339,454
Wait>0.01
LClick
Wait>0.01
Press Backspace * 10
Wait>0.01
Send>2
Send>0
Random>9,DiceResult
Send>%DiceResult%
Random>9,DiceResult
Send>%DiceResult%
Random>9,DiceResult
Send>%DiceResult%
Wait>0.1
MouseMove>1293,491
Wait>0.01
LClick
Wait>3.41
MouseMove>1800,210
Until>k,2
Re: Repeat statement not working.
Hi,
I'm appending to this old thread because I notice it never got answered. I have the same problem.
I'm now having a similar problem, also connected to a repeat. Am I just doing something stupid?
T does not get evaluated as a number, only as a string. I've tried % around the "k" and "e", and watching it in the debugger shows that it is clearly a string, pretty much no matter what I try.
As a result, the wait function doesn't work. Version 14.1.04 on Windows 7 Professional.
I'm appending to this old thread because I notice it never got answered. I have the same problem.
I'm now having a similar problem, also connected to a repeat. Am I just doing something stupid?
T does not get evaluated as a number, only as a string. I've tried % around the "k" and "e", and watching it in the debugger shows that it is clearly a string, pretty much no matter what I try.
As a result, the wait function doesn't work. Version 14.1.04 on Windows 7 Professional.
Code: Select all
MouseMove>850,-150
Let>e=575
Let>k=850
Let>t=(k-e)/1000
//MessageModal>%t%
Repeat>k
Let>k=k-1
MouseMove>%k%,-150
Wait>t
Until>k=e
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
Re: Repeat statement not working. SOLVED!
I guess the answer is to do the math in two steps:
this yields a string:
this yields a number:
this yields a string:
Code: Select all
Let>t=(k-e)/1000
Code: Select all
Let>t=%k%-%e%
Let>t=t/1000
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Repeat statement not working.
You need to do:
Let>t={(%k%-%e%)/1000}
Let>t={(%k%-%e%)/1000}
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Repeat statement not working.
That did the trick, thanks.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey