How to reset my "w" & "W" keys to default in my keyboard in Windows 7

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
TyrantRC
Posts: 5
Joined: 17 Jul 2017, 06:00

How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 06:15

I was using a script to play "Tomb Raider: The last revelation" with asdw movements instead of the arrow keys which is awkward in PC. This is the script I was using:

Code: Select all

w::up
a::left
s::down
d::right
r::z
After a game session, I exit the game and pressed exit option in the autohotkey icon in the system tray without suspending it first, then the w key was left acting as the "up" arrow instead of going back to default; all the other keys were back to default. The keyboard is working normally since I can use the key as the "up arrow" in a notepad, and I also tested it in my laptop and it works as normally would.

Is there any way to fix this? I'm left without a "w" key and 2 "up arrow" keys ._.

Things I have tried:
-Reseting the pc
-disconecting the keyboard
-enabling and suspending the same script, then pressing exit
-making this post
-updating the keyboard drivers via windows
-changing language settings in control panel
-changing keyboard layout in control panel (Region & Languages)
-unistalling AHK & reinstalling it
-unistalling AHK, reset the pc and then reinstalling it

PS: the w's in this post were written with the On-Screen Keyboard in windows, please help.
Last edited by TyrantRC on 17 Jul 2017, 07:07, edited 2 times in total.
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 06:29

Make sure you don't have any other scripts or programs that are open that change the "w" key.

A simple solution would be to revert the key back to normal:

Code: Select all

w::SendInput w ;Sends "instantly" instead of waiting

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

User avatar
TyrantRC
Posts: 5
Joined: 17 Jul 2017, 06:00

Re: How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 06:42

Delta Pythagorean wrote:Make sure you don't have any other scripts or programs that are open that change the "w" key.

A simple solution would be to revert the key back to normal:

Code: Select all

w::SendInput w ;Sends "instantly" instead of waiting
Should I just make a new script and run it? I tried your code in a script and it doesn't work even with the script running, the "w" key is still acting as "up arrow"

I also tried

Code: Select all

$w::SendInput w
since is the same key but still doesn't work

On a side note, I'm totally new with AutoHotkey, this is my first time using it so I don't know anything I should know

----
added a few new things I tried to the list
----
EDIT1:
So your post gave me an idea, I tried doing

Code: Select all

up::SendInput w
to see what it would do, and now I can write letter case w with the w key in the keyboard only if I have the script running, if I press shift+w it will act as I'm pressing shift+up arrow. So now I have 2 w keys and 0 up arrows, and I'm missing the uppercase w (W) as well. Its obviously a mapping problem with windows, It's like the map is pointing the w into up arrow in my operative system but it fails to reset to normal even if I close autoscript or reset my pc.
Last edited by TyrantRC on 17 Jul 2017, 06:52, edited 1 time in total.
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 06:51

Try using this in your original script:

Code: Select all

OnExit, Exit

w::up
a::left
s::down
d::right
r::z

Exit:
Suspend
ExitApp
This should suspend all keys before exiting. If this doesn't work, then uninstall and reinstall AHK. That's my best guess.

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

User avatar
TyrantRC
Posts: 5
Joined: 17 Jul 2017, 06:00

Re: How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 06:59

Delta Pythagorean wrote:Try using this in your original script:

Code: Select all

....
This should suspend all keys before exiting. If this doesn't work, then uninstall and reinstall AHK. That's my best guess.
I tried running your script again and it doesn't do anything, the w is still acting as up arrow after exiting and during the script, I guess that script should work so I can avoid this if I can fix the issue.

I also tried uninstalling AHK and before installing it again I checked if it was fixed (It wasn't), After reinstalling it was the same. Something tells me is a windows issue that AHK provoked somehow, probably a bug for closing without suspending.
User avatar
TyrantRC
Posts: 5
Joined: 17 Jul 2017, 06:00

Re: How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 08:04

After trying messing up with my windows registry I said fuck it, and I tried using SharpKeys(https://github.com/randyrants/sharpkeys/releases), and I finally fixed the mapping problem after modifying the registry with that.

It's definitely a bug of AHK leaving the hooks in the air like that. Not gonna report it because I already did so much work to fix my own shit. I'm gonna leave the solution here if some other bastard have my same problem. Thanks for nothing forum, at least 1 person tried.
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 09:41

TyrantRC wrote:After trying messing up with my windows registry I said fuck it, and I tried using SharpKeys(https://github.com/randyrants/sharpkeys/releases), and I finally fixed the mapping problem after modifying the registry with that.
Remappings in AutoHotkey are implemented by registering a hook through a Windows api, not by changing the registry. The hooks then calls to a running AHK process on each input event. So when the process ends the hook cannot call the function that remaps the key, and the hook times out and automatically unhooks in the event it wasn't unhooked properly 'manually'. That means suspending before exiting is unnecessary unless you force-kill the process, and even then, the hook will eventually unhook as well.
It's definitely a bug of AHK leaving the hooks in the air like that. Not gonna report it because I already did so much work to fix my own shit. I'm gonna leave the solution here if some other bastard have my same problem. Thanks for nothing forum, at least 1 person tried.
A little over a hundred minutes have passed, with currently only 10 registered users online. Perhaps you should re-evaluate your expectations. :facepalm:
Regardless, it's good that you fixed your problem, but your conclusions about its cause are incorrect.
User avatar
TyrantRC
Posts: 5
Joined: 17 Jul 2017, 06:00

Re: How to reset my "w" & "W" keys to default in my keyboard in Windows 7

17 Jul 2017, 11:20

Nextron wrote:Remappings in AutoHotkey are implemented by registering a hook through a Windows api, not by changing the registry. The hooks then calls to a running AHK process on each input event. So when the process ends the hook cannot call the function that remaps the key, and the hook times out and automatically unhooks in the event it wasn't unhooked properly 'manually'. That means suspending before exiting is unnecessary unless you force-kill the process, and even then, the hook will eventually unhook as well.
From what I understand the hook should die eventually, but I mean I even uninstalled the application and then I restarted the pc, shouldn't that just do it in the moment of uninstalling it? why would you leave hooks alive if they are not gonna be usable. Like you say it might not be a bug but is really an oversight. I definitely just did the first script that is shown to you in the documentation, a simple change of keys and it didn't unhook after closing the script, wasn't even a crash, it was a right click then exit. Imagine an new user that is totally new with how this work unable to fix this, he will eve try to change the keyboard because he would probably think is broken or something and will eventually will need to format his OS because there was not any way available for him. Losing an alphanumerical key is detrimental for anyone.

I'm gonna guess you are part of the developer team or at least the moderation team, you should probably reconsider then if adding an extra step in killing lose stuff by AHK when uninstalling it is a reasonable idea.

I know I sounded rough in the previous post, but I was really frustrated how little documentation exists on how this actually works, there is a lot about how it's used but is really hard to start using it properly if you don't have a basic concept of what's doing. Anyways, thanks for your answer.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: aitaixy, Anput, Nerafius, RandomBoy and 185 guests