Prevent modifier key release

Ask gaming related questions (AHK v1.1 and older)
Lambdadelta
Posts: 4
Joined: 01 Dec 2021, 01:21

Prevent modifier key release

Post by Lambdadelta » 01 Dec 2021, 01:46

Code: Select all

^a::
        SetKeyDelay, 100
        SendEvent, {LCtrl Down}wasd{LCtrl Up}
        Return
If I press Ctrl+a and release Ctrl when "wasd" is still in process of sending, "Ctrl up" will be send, and I'll have "{LCtrl Down}wa{LCtrl Up}sd{LCtrl Up}" instead.
How can I block sending "Ctrl up" until my SendEvent is finished? I want to block Ctrl only so BlockInput isn't a solution

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

Re: Prevent modifier key release

Post by Rohwedder » 01 Dec 2021, 02:29

Hallo,
try:

Code: Select all

$^a::
SetKeyDelay, 100
SendEvent, {Blind}{LCtrl Down}wasd{LCtrl Up}
Return

Lambdadelta
Posts: 4
Joined: 01 Dec 2021, 01:21

Re: Prevent modifier key release

Post by Lambdadelta » 01 Dec 2021, 23:20

Hi, I tried it and it doesn't work. Here's what happening
Image
As you see, "Ctrl Up, Ctrl Down" is still send
On the other hand, this code works, but as I said I'd like to avoid BlockInput

Code: Select all

^a::
        SetKeyDelay, 100
        BlockInput, Send
        SendEvent, {Blind}{LCtrl Down}wasd{LCtrl Up}
        Return

Post Reply

Return to “Gaming Help (v1)”