Auto-Clicker Not Pausing (Total Noob)

Get help with using AutoHotkey and its commands and hotkeys
Nightcapjack
Posts: 3
Joined: 09 Apr 2019, 09:34

Auto-Clicker Not Pausing (Total Noob)

09 Apr 2019, 09:45

Greetings!

I'm just starting out with AutoHotKey, so I'm not very familiar with recognizing why something works and why it doesn't. I want the script to pause by pressing the "w" key, but the "::Pause" command doesn't work for my script. I've written this code for my auto-clicker:

Code: Select all

w::Pause
Return

q::
Loop
{
    timing := milli
    SetMouseDelay, 100
    Click, 1
}
Return
The auto-clicker function works just fine, but I can't figure out why it pressing "w" doesn't pause the script. It just continues to click. Would someone be able to tell me what's malfunctioning and why?

Thanks for the help! :wave:

-Nightcapjack
User avatar
jeeswg
Posts: 6651
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Auto-Clicker Not Pausing (Total Noob)

09 Apr 2019, 10:02

- Try this:

Code: Select all

w::
Pause
return
- Pause is both a command and the name of a key. So there's some ambiguity there.
- So, w::Pause is probably remapping rather than pausing. Since 'key1::key2' is usually used for remapping. Cheers.

- Links:
Remapping Keys (Keyboard, Mouse and Joystick) | AutoHotkey
https://autohotkey.com/docs/misc/Remap.htm
List of Keys (Keyboard, Mouse and Joystick) | AutoHotkey
https://autohotkey.com/docs/KeyList.htm
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Nightcapjack
Posts: 3
Joined: 09 Apr 2019, 09:34

Re: Auto-Clicker Not Pausing (Total Noob)

09 Apr 2019, 10:10

Ah! That makes perfect sense. I didn't think about "pause" also being a key, as well as a command. Thank you so much for your help, but I'm afraid it still doesn't want to pause. If I activate the pause key ("w" in this case) before I activate the loop script, I can see it pausing the script whenever I press "w". But once I activate the loop, "w" no longer pauses the script.
User avatar
jeeswg
Posts: 6651
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Auto-Clicker Not Pausing (Total Noob)

09 Apr 2019, 10:25

- You can get w to set a variable that q checks.
- Or you could get another script to pause your script.
list of AutoHotkey WM_COMMAND IDs (e.g. Reload/Edit/Suspend/ListVars on another script) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=74&t=27824
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Nightcapjack
Posts: 3
Joined: 09 Apr 2019, 09:34

Re: Auto-Clicker Not Pausing (Total Noob)

10 Apr 2019, 05:33

Thank you for looking into that for me! I actually came across a section in the AutoHotKey FAQ's titled "How can a repeating action be stopped without exiting the script?", and that section gave me the framework to insert my looping script. So this is what I got:

Code: Select all

#MaxThreadsPerHotkey 3
#z::
#MaxThreadsPerHotkey 1
if KeepWinZRunning
{
    KeepWinZRunning := false
    return 
}

KeepWinZRunning := true
Loop
{
    timing := milli
    sleep 1
    SetMouseDelay, 1
    sleep 1
    Click, 1
    sleep 1
    if not KeepWinZRunning
        break
}
KeepWinZRunning := false
return
Thank you jeeswg for providing the information that you did. The AutoHotKey community is awesome! :D

Return to “Ask For Help”

Who is online

Users browsing this forum: aseiot, flyingDman and 167 guests