Before I start, I just have to say that I search that simple thing to do not create this topic unnecessarily.
Said that, let me explain my issue.
Years ago I was learning AHK function, but now I don't remember much things. I create a infinite loop pretty simple (use some hotkey to on and another to off loop). But, recently I'm having some real problems about the time of the ending of loop.
When I press the key to put it off, it is not breaking immediatly, that just turn off when the loop complete the actions.
Here's my poor script:
Code: Select all
2::
LoopRunning := 1
while (LoopRunning)
{
Send {F7}
Sleep 1100
Send {F8}
Sleep 1100
Send {F6}
Sleep 1100
}
Space::
LoopRunning := 0
Return
I search on forum and tried this ones:
And this one:Code: Select all
Loop { If stop = 1 Break Else { ControlSend,, 2, ahk_id %program2% Sleep 2520 } } return F4:: If stop = 1 stop = 0 Else stop = 1 return
But I couldn't text it pretty much, because I have some lines (sends) and not just one, so I don't know how to properly put my function inside the { } or something like that.Code: Select all
Loop { if GetKeyState("F4","P") Break ControlSend,, 2, ahk_id %program2% Sleep 2520 }
It's pretty simple, but Idk how to to it x.x
Someone can please help me here?
Btw, I use this command to make me do another stuffs, so I can't use Esc as another hotkey
Code: Select all
Esc::
Suspend
Return