So I read the help file on loops and breaks, but the only example is if a var > 25 or var <= 5, etc.
What I want is a loop to break if a key is pressed.
Take for example, my script:
Best Answer Exaskryz , 24 November 2014 - 10:21 PM
So I read the help file on loops and breaks, but the only example is if a var > 25 or var <= 5, etc.
What I want is a loop to break if a key is pressed.
Take for example, my script:
Hello again
This is probably not the best way of doing it but it works
Press o to stop the timer/loop or wait until it have looped 50 times
BreakKey = {o} Del:: SetTimer, Looper, 200 Input,Key, I L1, %BreakKey% SetTimer, Looper, Off return Looper: Counter++ IF (Counter = 50) { MsgBox Loop OFF SetTimer, Looper, Off } Send L random,xx,750,1500 sleep %xx% send K Sleep 4800 return
Alright, I'll test this out. Seems pretty nice though.
Yes, this works! Now, instead of making another thread, I just need one more request.
I want a MsgBox to pop up and tell me the xx number that it picks each time. I'm trying to test for a certain time, so if it lands on the time I want, I will press o to end the loop, and when I end the loop, it will say what xx was. I'm looking for a certain error message with this script, so I know when to press o. The reason I have a random generator for xx is so that I can find that time.
Summary:
Press O to end loop when error message is found, MsgBox pops up telling what xx was.
Do you mean like this?
MsgBox, Random Number: %xx% Loops made: %Counter%
OR
Tooltip, Random Number: %xx% Loops made: %Counter%
OR
fileappend, Random Number: %xx% Loops made: %Counter%`n,Debug.txt
BreakKey = {o} X:: SetTimer, Looper, 200 Input,Key, I L1, %BreakKey% SetTimer, Looper, Off return Looper: Counter++ random,xx,750,1500 MsgBox, Random Number: %xx% Loops made: %Counter% IF (Counter = 50) { MsgBox Loop OFF SetTimer, Looper, Off } Send L sleep %xx% send K Sleep 4800 return
Do you mean like this?
MsgBox, Random Number: %xx% Loops made: %Counter%
OR
Tooltip, Random Number: %xx% Loops made: %Counter%
OR
fileappend, Random Number: %xx% Loops made: %Counter%`n,Debug.txt
BreakKey = {o} X:: SetTimer, Looper, 200 Input,Key, I L1, %BreakKey% SetTimer, Looper, Off return Looper: Counter++ random,xx,750,1500 MsgBox, Random Number: %xx% Loops made: %Counter% IF (Counter = 50) { MsgBox Loop OFF SetTimer, Looper, Off } Send L sleep %xx% send K Sleep 4800 return
Beautiful and working, but is there a way to make it log the numbers automatically?
You can probably make it log by using something like FileAppend or IniWrite, depending on how you'd like it done. I encourage you to read up on those. (Both so you can learn and because I don't have much time to keep procrastinating on my studies, hehe.)