Toggleable Auto Clicker help

Get help with using AutoHotkey and its commands and hotkeys
stuarty27
Posts: 1
Joined: 09 Aug 2020, 05:59

Toggleable Auto Clicker help

09 Aug 2020, 06:10

Hi everyone, i'm wondering if someone could get me a bit of a hand here. I'm trying to get a script together to auto click the left mouse button when a toggle is activated, i dont want to have the left mouse button held down in order to activate the auto click procedure though, i used to have a script which worked perfectly however i must have deleted it at some point and is now endlessly frustraiting for me to recreate :P.
At the moment this is the script i'm using:

Code: Select all

lctrl & z::
 {
   keywait, lctrl
   mtoggle := !mtoggle
 }
return

#if (mtoggle)
$lbutton::
 {
   while getkeystate("lbutton", "p")
    {
      sendinput, {lbutton}
      sleep, 50
    }
 }
return
[Mod edit: [code][/code] tags added.]


Hopefully someone can help me out here :), also, it'd probably be good to have a way of closing the script if something goes wrong, maybe Escape should end the script? I'm just spitballing here, i'm very much looking forward to seeing what you guys come up with, thanks very much in advance :).
Rohwedder
Posts: 3377
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Toggleable Auto Clicker help

09 Aug 2020, 06:49

Hallo,
try:

Code: Select all

<^z:: ;lctrl & z 
keywait, lctrl
mtoggle := !mtoggle
SetTimer, mtoggle,% mtoggle?50:"Off" ;every 50ms
return
mtoggle:
sendinput, {lbutton}
return

Return to “Ask For Help”

Who is online

Users browsing this forum: f1ster, TAC109 and 28 guests