Looking For Help with a Weird Hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bignstrauss
Posts: 2
Joined: 25 Nov 2021, 03:07

Looking For Help with a Weird Hotkey

25 Nov 2021, 03:22

So my keyboard is faulty and the combination of Shift + W + 2 does not work, it registers the Shift and W but not the 2 input if the previous two keys are pressed. I use this combination in one of my games to switch weapons while sprinting. The keyboard is out of warranty so I'm trying to make a script to work as a stop gap. It should be a simple one. If Shift + W is held and I press 2 the script will simply send a {2}.

I have a decent knowledge of AutoHotkey but am not sure if the above scenario can be done. Any information or examples would be greatly appreciated. Thanks.
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Looking For Help with a Weird Hotkey

25 Nov 2021, 05:13

Hallo,
try:

Code: Select all

+w::SoundBeep, 4000, 20 ;to switch weapons while sprinting
#IF GetKeyState("Shift","P") And GetKeyState("w","P")
*2::Send, 2
#IF
Edit because of amateur+'s objections
Last edited by Rohwedder on 25 Nov 2021, 07:27, edited 1 time in total.
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Looking For Help with a Weird Hotkey

25 Nov 2021, 05:47

@Rohwedder, my keyboard doesn't pass 2 at all if Shift+w are already down.
If I look at GetKeyState("2", "P"), it is 0 at that moment.
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Looking For Help with a Weird Hotkey

25 Nov 2021, 06:10

Another moment: he won't be able to use Shift+W to sprint in his game, b/c with Shift being held down, W becomes a prefix and assigning w up:: won't help.
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
bignstrauss
Posts: 2
Joined: 25 Nov 2021, 03:07

Re: Looking For Help with a Weird Hotkey

04 Dec 2021, 01:16

Hey all, thanks for the replies. I just bit the bullet and got a new keyboard so this question is no longer needed. Thanks anyway though!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 215 guests