Left button click with pause

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
beachxbunny
Posts: 10
Joined: 01 Nov 2019, 12:03

Left button click with pause

Post by beachxbunny » 19 Aug 2022, 11:12

The code below works perfectly, it just auto clicks LMB while the mouse button is held down. However I want to be able to add a pause in between clicks so maybe 3 seconds of fast clicking...pause for .5 seconds then 3 seconds again then pause .5 seconds etc. all while holding down left mouse button. Any chance of adding that into my current code?

Code: Select all

enabled:= false

~$LButton::
	if( enabled ){
		KeyWait LButton, T0.0
		If ErrorLevel
			While GetKeyState("LButton", "P"){
				Click
				Sleep 25
			}
	}
return

8:: enabled := !enabled

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

Re: Left button click with pause

Post by mikeyww » 19 Aug 2022, 12:55

Code: Select all

8::
enabled := !enabled
SoundBeep, 800 + 500 * enabled
Return

#If enabled
~LButton::
SoundBeep, 1500
While GetKeyState("LButton", "P") {
 end := A_TickCount + 3000
 While GetKeyState("LButton", "P") && A_TickCount < end && enabled
  Click
 Sleep, 500 * enabled * GetKeyState("LButton", "P")
}
SoundBeep, 1000
Return
#If

Post Reply

Return to “Ask for Help (v1)”