Press 2 buttons at the same time? Topic is solved

Ask gaming related questions (AHK v1.1 and older)
james2

Press 2 buttons at the same time?  Topic is solved

20 Mar 2018, 07:40

Hello,
What is the best way to make 2 buttons pressed at the same time ( Time delay between 2 presses is as short as possible)?
CPLNet
Posts: 53
Joined: 06 Dec 2016, 11:24

Re: Press 2 buttons at the same time?

20 Mar 2018, 08:24

make 2 labels



label1:
send {K Down}
send {K up}
return

label2:
send {K Down}
send {K up}
return

*~$n::
{
gosub label1
gosub label2
}
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Press 2 buttons at the same time?

20 Mar 2018, 10:33

Hallo,
let two scripts run at the same time.
F4 presses a and b almost simultaneously.
A.ahk:

Code: Select all

~F4::a
B.ahk:

Code: Select all

~F4::b
(If pressing F4 is bothering, use a third script to mask F4)
F4.ahk:

Code: Select all

F4::Return
But this simultaneity is unnecessary!

I recommend you:
Key a presses a and b:

Code: Select all

~a::b
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Press 2 buttons at the same time?

20 Mar 2018, 11:09

Technically if the purpose of this is to trigger two actions that you want to go simultaneously then Send, {a}{b} should do the job. There's hardly any delay.
Of course you can do what rohwedder did too. The problem with ~a::b is that the hotkey will be triggered when a is pressed as well!
I am your average ahk newbie. Just.. a tat more cute. ;)
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Press 2 buttons at the same time?

20 Mar 2018, 12:38

It really depends on what you mean by "Press at the same time".
As Nwb says Send, {a}{b} will send keys quickly, but using that, at no point are the two keys "held" simultaneously (It presses, then releases each key in sequence).
If you truly want to hold two keys at the same time, you would want Send, {a down}{b down}{b up}{a up}

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 144 guests