Stop/resume loop with keypress

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
sn1perwild
Posts: 62
Joined: 04 Aug 2021, 15:11

Stop/resume loop with keypress

04 Aug 2021, 15:19

Hello, all!

I'm having a hard time figuring out how to make this loop stop when I press any key. I also want it to run again if I use the hotkey associated with the loop.

Bear in mind I'm extremely new to AHK (I built the script using Pulover Macro Creator), so please keep instructions as simple as possible :cry:

Here is the code:

Code: Select all

+^!m::
Loop:
Loop
{
    Sleep, 500
    Send, {End}
    Sleep, 500
    Click, 1163, 267 Left, 1
    Sleep, 10
    Sleep, 800
    Send, {End}
    Sleep, 500
    Click, 859, 666 Left, 1
    Sleep, 10
    Sleep, 2000
    Click, 948, 419 Left, 1
    Sleep, 10
    Sleep, 500
}
Return
Thanks in advance for the help :)
User avatar
mikeyww
Posts: 26888
Joined: 09 Sep 2014, 18:38

Re: Stop/resume loop with keypress

04 Aug 2021, 18:43

Here is one example of an idea.

Code: Select all

+^!m::
on := True
SoundBeep, 1500
SetTimer, Go, 100
Input, key, IVL1, % "{LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}"
                  . "{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}"
                  . "{End}{PgUp}{PgDn}{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}"
on := False
SetTimer, Go, Off
SoundBeep, 1000
Return
Go:
Send % on ? "x" : ""
Sleep, 1000 * on
Return
User avatar
sn1perwild
Posts: 62
Joined: 04 Aug 2021, 15:11

Re: Stop/resume loop with keypress

05 Aug 2021, 20:39

Thank you very much! :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Frogrammer, gongnl, scriptor2016 and 273 guests