release other key first then press that key

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Valiar
Posts: 4
Joined: 10 Aug 2020, 23:34

release other key first then press that key

Post by Valiar » 30 May 2023, 01:50

Hi,

I want to create a macro that when I press a certain key (say Q), it will first release a list of keys (say WASD,CAPS) if they are pressed then press that key.

could anyone help me code this macro? Thanks in advance.

Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: release other key first then press that key

Post by Rohwedder » 30 May 2023, 02:17

Hallo,
try:

Code: Select all

#Requires AutoHotkey v2.0
*q::Send "{Blind}{w Up}{a Up}{s Up}{d Up}{CapsLock Up}{q DownR}"
~*q Up::Return

Valiar
Posts: 4
Joined: 10 Aug 2020, 23:34

Re: release other key first then press that key

Post by Valiar » 30 May 2023, 16:57

its not working,

it still press the two keys at the same time, what i am looking for is when I press Q, WASD is released even if they are pressed physically

Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: release other key first then press that key

Post by Rohwedder » 31 May 2023, 02:34

Then perhaps?:

Code: Select all

#Requires AutoHotkey v2.0
*q::Send "{Blind}{w Up}{a Up}{s Up}{d Up}{CapsLock Up}{q DownR}"
~*q Up::
q & w::
q & a::
q & s::
q & d::Return
or:

Code: Select all

#Requires AutoHotkey v2.0
~*q::Send "{Blind}{w Up}{a Up}{s Up}{d Up}{CapsLock Up}"
q & w::
q & a::
q & s::
q & d::Return
or:

Code: Select all

#Requires AutoHotkey v2.0
~w::
~a::
~s::
~d::
~CapsLock::Return
w & ~q::Send "{Blind}{w Up}"
a & ~q::Send "{Blind}{a Up}"
s & ~q::Send "{Blind}{s Up}"
d & ~q::Send "{Blind}{d Up}"
CapsLock & ~q::Send "{Blind}{CapsLock Up}"

Post Reply

Return to “Ask for Help (v2)”