How to suspend a script with double press Alt?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DeepMind
Posts: 271
Joined: 19 Jul 2016, 14:47

How to suspend a script with double press Alt?

22 Jul 2016, 04:52

This is the code but i don't know why it doesn't work

Code: Select all

LAlt::
	If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
		Suspend

Return
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: How to suspend a script with double press Alt?

22 Jul 2016, 08:05

This works for me,

Code: Select all

LAlt::
	Suspend, Permit				; Remove this line if you don't want to be able to unsuspend the script by double-taping again.
	KeyWait, LAlt
	KeyWait, LAlt, D T0.5	 	;  0.5 is the time to wait, in seconds.
	if !ErrorLevel
		Suspend,Toggle 
return
Cheers!

Edit: Actually, your script works, if you want to toggle, just add the Permit and Toggle as in my script.

Return to “Ask for Help (v1)”

Who is online

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