stuck with priorkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chulain
Posts: 18
Joined: 24 Mar 2018, 08:06

stuck with priorkey

24 Mar 2018, 08:11

:wave:

I would like my script to press the numpad enter button if the previous key was escape & within the past 2 seconds
this is what I got so far, it currently works for the enter key, I did not manage to set it to the escape key.

Enter::
If (A_TimeSincePriorHotkey < 2000 and A_TimeSincePriorHotkey !=-1)
Send, {NumpadEnter}
else
return

any help is appreciated :D
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: stuck with priorkey

24 Mar 2018, 20:10

Code: Select all

esc::
EscVar := 1
SetTimer, EscVar, -2000
return

EscVar:
EscVar := 0
return

#if EscVar
Enter::
Send, {NumpadEnter}
EscVar := 0  ; optional line to terminate the 2-second window
return
#if
chulain
Posts: 18
Joined: 24 Mar 2018, 08:06

Re: stuck with priorkey

26 Mar 2018, 11:30

AlphaBravo wrote:

Code: Select all

esc::
EscVar := 1
SetTimer, EscVar, -2000
return

EscVar:
EscVar := 0
return

#if EscVar
Enter::
Send, {NumpadEnter}
EscVar := 0  ; optional line to terminate the 2-second window
return
#if
Heya, thanks for your post! I'm not sure what your script does tho? Doesn't seem to be what I'm looking for :(
I want the enter key to ONLY function if the escape key was pressed in the past two seconds.

Also, is it possible to maintain the original purpose of my escape key while getting a script for this?
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: stuck with priorkey

26 Mar 2018, 12:58

modified it to :
enter key to ONLY function if the escape key was pressed in the past two seconds, maintain the original purpose of my escape.

Code: Select all

~esc::
EscVar := 1
SetTimer, EscVar, -2000
return

EscVar:
EscVar := 0
return

Enter::
if !EscVar
	return
Send, {NumpadEnter}
EscVar := 0  ; optional line to terminate the 2-second window
return
chulain
Posts: 18
Joined: 24 Mar 2018, 08:06

Re: stuck with priorkey

27 Mar 2018, 14:05

sir, I am so grateful for your help :dance:
chulain
Posts: 18
Joined: 24 Mar 2018, 08:06

Re: stuck with priorkey

27 Mar 2018, 15:42

I messed around a bit with it but I failed to add one more thing I need.

I kinda feel bad for requesting your assistance once more, but is it possible to have this AND make the enter function work if left mouse button was double pressed, past 2 seconds?
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: stuck with priorkey

28 Mar 2018, 18:39

add the following :

Code: Select all

~LButton::
if (A_ThisHotkey = A_PriorHotkey) && (A_TimeSincePriorHotkey < 300)
{
	EscVar := 1
	SetTimer, EscVar, -2000
}
return
chulain
Posts: 18
Joined: 24 Mar 2018, 08:06

Re: stuck with priorkey

29 Mar 2018, 13:33

you're my hero lol :D :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], RandomBoy and 243 guests