Hello, I'm making just a simple clicker code like so:
Code: Select all
^+!0::
KeyWait Alt
KeyWait Control
KeyWait Shift
ToggleThis := !ToggleThis
Loop, 1000 {
if not ToggleThis
break
Send {LButton}
Sleep 20
}
return
So hopefully if I do ctrl+alt+shift+0, it should start and stop a quick clicker. The problem is that it can start, but trying the hotkey again will not stop the loop. It basically has to wait for the loop to finish before I can press ctrl+alt+shift+0 again. Of course, that time it sets ToggleThis to false, so I have to press it one more time and then it will just run the loop again.
I have also tried:
Code: Select all
^+!9::
Toggle := !Toggle
If Toggle
SetTimer, Trigger, -1
return
Trigger:
While (Toggle)
{
Send {LButton}
Sleep 20
}
Return
In the hopes that the while loop would just keep going and I could press ctrl+alt+shift+9 to stop or start it. It still doesn't work, though: once the loop is started, I can't stop it and have to ExitApp.
However, if the starting and stopping code is a single key, it works just fine:
Code: Select all
NumpadDiv::
StopLoop = 1
return
NumpadMult::
StopLoop = 0
return
^+!8::
; KeyWait Alt
; KeyWait Control
; KeyWait Shift
Loop, 1000 {
if (StopLoop = 1)
break
Send {LButton}
Sleep 20
}
return
I can press the keys to stop the loop instantly without exitingApp and then just reset the variable and start it again. I just want to do this not using up any base key presses: I'd much rather hold ctrl and/or alt and/or shift when pressing these. Is there any way to have this work? I'd love to have:
Code: Select all
^+!NumpadDiv::
StopLoop = 1
return
^+!NumpadMult::
StopLoop = 0
return
^+!8::
; KeyWait Alt
; KeyWait Control
; KeyWait Shift
Loop, 1000 {
if (StopLoop = 1)
break
Send {LButton}
Sleep 20
}
return
But right now it does not. Any help would be appreciated. Thanks!