andymbody wrote: ↑05 Jan 2023, 19:31
I removed the code... Tooltip
lol... I forgot to remove that before posting... I was using it for test the loop
Do you mind If i ask for help with a similar problem but now with a different code? The code does the same thing, but this time I control the loop with the same activation key which is #2
Code: Select all
2::
SetTimer VAR,% (VAR:=!VAR)?200:"Off"
IF !RBraket
return
VAR:
Random, Rand, 1, 100000
IF (Rand <= 95000) ;with 95% chance
{
sendinput, {1 down}
sleep, 200
sendinput, {1 up}
}
Else
{
sendinput, {1 down}
sleep, 2000
sendinput, {1 up}
}
Return
Basically, if I press #2, the code executes. If I press #2 again the code halts, if i press #2 again the code starts again etc.... So basically #2 acts like an ON and OFF switch.
When I press 9, I want the code to halt or resume, just as if I was pressing the #2 key with my finger. This is the code I have:
Code: Select all
9::
sendinput, {2 down}
sleep, 100
sendinput, {2 up}
return
But it does not work! The code never stops, its as if nothing is pressing #2.
[Mod edit: Changed a quote set of quote tags to code tags.]