Send keys simultaneously during a loop

Ask gaming related questions (AHK v1.1 and older)
overlord132
Posts: 14
Joined: 09 Nov 2015, 18:31

Send keys simultaneously during a loop

Post by overlord132 » 19 Jun 2021, 13:51

Hi, guys
I need a script where I only hold the E key and then start a loop where the "2" key is pressed repeatedly while the "V", "B" and "N" keys are being pressed in another loop. All activated in a single key.
I'm new to scripting and my English is bad for reading tutorials.

Thank you in advance for all your help.
User avatar
mikeyww
Posts: 26869
Joined: 09 Sep 2014, 18:38

Re: Send keys simultaneously during a loop

Post by mikeyww » 19 Jun 2021, 14:05

Code: Select all

e::
Send {v down}{b down}{n down}
SetTimer, Go, 20
KeyWait, e
SetTimer, Go, Off
Send {n up}{b up}{v up}
Return
Go:
Send 2
Return
overlord132
Posts: 14
Joined: 09 Nov 2015, 18:31

Re: Send keys simultaneously during a loop

Post by overlord132 » 19 Jun 2021, 14:20

mikeyww wrote:
19 Jun 2021, 14:05

Code: Select all

e::
Send {v down}{b down}{n down}
SetTimer, Go, 20
KeyWait, e
SetTimer, Go, Off
Send {n up}{b up}{v up}
Return
Go:
Send 2
Return
This script got stuck on the "E" key and didn't turn off when I pressed it again. I forgot to mention that the "E" key repeat delay is 250 ms and the "V", "B" and "N" key repeat delay is 2.5 seconds. I also forgot to mention that these need to be in a queue, eg "V" key first, "B" key second and "N" key last. All with 2.5 secs delay between
User avatar
mikeyww
Posts: 26869
Joined: 09 Sep 2014, 18:38

Re: Send keys simultaneously during a loop

Post by mikeyww » 19 Jun 2021, 15:44

You referred to holding the key rather than pressing it again. Perhaps you can give a step-by-step example of exactly what should happen.
Post Reply

Return to “Gaming Help (v1)”