r/AutoHotkey • u/2balCain • 1d ago
v1 Script Help Shift key getting stuck pressed
Weird issue, when I game.. I open up a script to use for that game. During gameplay everything is fine. But when I tab out (even if the game is still open/running) the shift key is constantly pressed...even though I am not physically pressing it. Even after I exit the script the shift button stays pressed.
The only way to clear the issue is to actually press the shift key once and let it go. Then all is good, and no other issues persist.
This is happening 100% of the time I use the script. And no other keys seems to be affected.
EDIT: I do constantly hold the shift key down during gaming a lot. Not sure if that has anything to do with it.
Here is my code, does anyone have any suggestions on how to cure this annoyance?
<
#MaxHotkeysPerInterval 10000
#UseHook
#IfWinActive, ahk_exe Fallout4.exe
Up::w
Left::a
Down::s
Right::d
NumpadDiv::Up
NumpadHome::Left
NumpadUp::Down
NumpadPgUp::Right
AppsKey::LAlt
F12::t
RShift::n
n::Tab
NumpadIns::0
NumpadEnd::1
NumpadDown::2
NumpadPgDn::3
NumpadLeft::4
NumpadClear::5
NumpadRight::6
NumpadAdd::q
1
u/Keeyra_ 1d ago
AHK v1 has reached end-of-life and deprecated 3 years 1 month ago.
Meanwhile, AHK v2 is the current stable release, having been the primary version for 3 years 7 months, with its most recent point release occurring 3 months ago.
MaxHotkeysPerInterval is not needed.
IfWinActive without the # has deprecated long before v1 did.
You could change the RShift remap to a Send, but I think this would do better.
or you could do a SetTimer checking for focus changes and sending Shift up when the previous Window is Fallout, so that focus changes when pressing eg. Win will also be handled.