Autoclicker (hold down) with macro enable/disable button

Ask gaming related questions (AHK v1.1 and older)
vaarelsauce
Posts: 1
Joined: 15 May 2022, 16:23

Autoclicker (hold down) with macro enable/disable button

Post by vaarelsauce » 15 May 2022, 16:27

I'd like to make my F1 button toggle a particular macro on and off.
This particular macro works when holding down the left click mouse button, it would continuously spam it (basically an auto clicker).

I've gotten the autoclicker to work below, but I'm not familiar with implementing it inside of a macro on/off call.
!LButton::
While GetKeyState("LButton", "P") & GetKeyState("Alt", "P")
Click
Return

User avatar
mikeyww
Posts: 26875
Joined: 09 Sep 2014, 18:38

Re: Autoclicker (hold down) with macro enable/disable button

Post by mikeyww » 15 May 2022, 18:46

Code: Select all

F1::
on := !on
SoundBeep, 1000 + 500 * on
Return

#If on
!LButton::
While GetKeyState("LButton", "P") & GetKeyState("Alt", "P")
 Click
Return
#If

WAMTASTICA
Posts: 4
Joined: 11 Nov 2023, 16:06

Re: Autoclicker (hold down) with macro enable/disable button

Post by WAMTASTICA » 11 Nov 2023, 16:08

Are you able to convert this to V2? This is exactly what i need also but in V2

User avatar
DuckingQuack
Posts: 219
Joined: 20 Jan 2023, 18:20

Re: Autoclicker (hold down) with macro enable/disable button

Post by DuckingQuack » 11 Nov 2023, 17:58

@WAMTASTICA This is a direct conversion to V2... I'm not sure if you're aware of this, but this script will only spam the LMB if you are also holding down Alt at the same time as LMB (after turning it on with F1). If that's not exactly what you were wanting, then I can modify this accordingly. Also, as it is written, the CPS is over 200... which has the potential to be very lag inducing, so you may want to have a delay between clicks added too.

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
InstallMouseHook
InstallKeybdHook

Esc:: ExitApp

on := false
F1:: {
    Global
    on := !on
    SoundBeep(1000 + 500 * on)
}
#HotIf on
!LButton:: {
    While GetKeyState("LButton", "P") & GetKeyState("Alt", "P")
    Click
}
#HotIf
Best of Luck,
The Duck

stellar
Posts: 1
Joined: 18 Jan 2024, 10:13

Post by stellar » 25 Jan 2024, 08:22

@DuckingQuack hello Can u make the same script without it require to holding down alt at all just hold left click and it start clicking
I try to edit it but it doesnt stop when left click is up

User avatar
DuckingQuack
Posts: 219
Joined: 20 Jan 2023, 18:20

Re: Autoclicker (hold down) with macro enable/disable button

Post by DuckingQuack » 26 Jan 2024, 09:54

@stellar
Yes! Hope all is finding you well today.
There are lots of ways to do this, but try to use a SLEEP or a timer to create a small delay, preventing the script from sending clicks as quickly as your processor will allow as this tends to cause your computer to crash.
There are already tons of auto-clickers on this site and here are two posts with some great info about making them do exactly what you need them to do. I suggest looking them over.
viewtopic.php?f=94&t=115449&p=554289&hilit=auto+clicker#p554289
viewtopic.php?p=460435#p460435

Hopefully this will work for you:

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
InstallMouseHook
InstallKeybdHook

Esc:: ExitApp

on := false
F1:: {
    Global
    on := !on
    SoundBeep(1000 + 500 * on)
}
#HotIf on
~$LButton:: {
    While GetKeyState("LButton", "P") {
    Click("L")
    Sleep(100)
   }}
Best of Luck,
The Duck

Post Reply

Return to “Gaming Help (v1)”