trying to add a sleep to this.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bibloffxi
Posts: 4
Joined: 08 Apr 2021, 17:34

trying to add a sleep to this.

12 Jan 2024, 10:50

Code: Select all

Capslock::
    
	If ( toggle := !toggle ) {
		Click, Down Left
	}
	Else {
		Click, Up Left
		}
			
	Return
only want it to run about once every 30 seconds. I tried adding sleep, 30000 before if and it won't start. if i add it after else i can't stop it.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: trying to add a sleep to this.

12 Jan 2024, 12:08

Hello,

Your script does nothing every 30 seconds or on any other interval. It executes a single action based on manually triggering your hotkey. If needed, you could add :arrow: SetTimer.
bibloffxi
Posts: 4
Joined: 08 Apr 2021, 17:34

Re: trying to add a sleep to this.

12 Jan 2024, 13:03

Is there a way to fix or rewrite is so it clicks left mouse button every 30 seconds then?

I tried SetTimer, KeyWinC, -400 but it failed to load.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: trying to add a sleep to this.

12 Jan 2024, 14:21

Code: Select all

#Requires AutoHotkey v1.1.35
CapsLock::SetTimer CapsLock Up, % (on := !on) ? 30000 : "Off"
CapsLock Up::Send % ["{LButton}"][on]
bibloffxi
Posts: 4
Joined: 08 Apr 2021, 17:34

Re: trying to add a sleep to this.

12 Jan 2024, 14:37

Thx so much. That worked Great.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: bobstoner289, Chunjee, Google [Bot], macromint, peter_ahk and 342 guests