Putting a settimer to turn off loop
Posted: 11 Mar 2024, 10:38
So I have this code where it loops F1>Click>F2 and has the 5:: function to have it turned off and on
Can anyone help with putting a settimer or any command that when I press 5 to start the command, it'll start looping and after a set time it will press END>F9 and then turn off the loop?
I tried fiddling with the source code and ultimately cannot achieve this. Any help would be appreciated.
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
[Mod edit: Moved topic from AHK v2 help to v1 help, based on posted code.]
Can anyone help with putting a settimer or any command that when I press 5 to start the command, it'll start looping and after a set time it will press END>F9 and then turn off the loop?
I tried fiddling with the source code and ultimately cannot achieve this. Any help would be appreciated.
Code: Select all
#MaxThreadsPerHotkey 3
5::
#MaxThreadsPerHotkey 1
if KeepWinZRunning
{
KeepWinZRunning := false
return
}
KeepWinZRunning := true
Loop
{
Send {F1}
Sleep 0
MouseClick, Left
Send {F2}
Sleep 100
if not KeepWinZRunning
break
}
return
ESC::ExitApp
[Mod edit: Moved topic from AHK v2 help to v1 help, based on posted code.]