Key down hotkey is interrupted when other hotkeys fire

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
EKE
Posts: 8
Joined: 08 Oct 2018, 08:52

Key down hotkey is interrupted when other hotkeys fire

20 Mar 2019, 18:40

When I activate a hotkey which has a keydown event held indefinitely and then fire another hotkey, that former hotkey with the keydown event seems to be interrupted/removed so in this case the LShift down never returns back to LShift down.

In the code below the 'w' key is pressed twice in a certain amount of time to trigger a games native auto run feature with a hotkey. However, to sprint the 'shift' key must be held down so this hotkey also sends a 'LShift Down' indefinitely until it is broken. When the hotkey Xbutton1 fires to send 'm' the previous hotkey no longer is continuing with 'LShift Down'.

What I have read so far is that ' AutoHotkey is not a "multitasking" app ', that the hotkey is being put on hold, and that maybe using some run command may help? Or maybe creating multiple ahk scripts? Not sure how to proceed.

Code: Select all

 
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#MaxThreadsPerHotkey 2

RCtrl & SC50:: 	;2 auto sprint (rctrl & numpad2)
	Send {w down}
	Sleep 50
	Send {w up}
	Sleep 50
	Send {w down}
	Sleep 50
	Send {w up}
	Send {LShift Down}
	return

XButton1::m 	;4 map
abcjme
Posts: 65
Joined: 08 Mar 2018, 10:48

Re: Key down hotkey is interrupted when other hotkeys fire

21 Mar 2019, 03:07

· if other buttons are pressed after, then there's no way to keep shift down forever
· you'll have to just re-activate it when needed


XButton1::
send m
sleep 50
send {lshift down}
return
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Key down hotkey is interrupted when other hotkeys fire

21 Mar 2019, 05:36

• turn on {Blind} on all send commands apart from LShift
or
• turn lshift into {Lshift DownR}. but this will briefly release shift when non-blind keystrokes are sent and repress it when sending has finished
EKE
Posts: 8
Joined: 08 Oct 2018, 08:52

Re: Key down hotkey is interrupted when other hotkeys fire

25 Mar 2019, 21:26

swagfag wrote:
21 Mar 2019, 05:36
• turn on {Blind} on all send commands apart from LShift
or
• turn lshift into {Lshift DownR}. but this will briefly release shift when non-blind keystrokes are sent and repress it when sending has finished
I tried using the blind method but it seemed to fail so maybe I wrote it wrong and unfortunately dont have the copy. However I changed all my hotkeys to use the reserved F13-F24 keys and now I no longer have the issue. So thats awesome.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Chunjee, Google [Bot], macromint, peter_ahk and 331 guests