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

Get help with using AutoHotkey 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] [Download] GeSHi © Codebox Plus

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: 306
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Equestria

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] [Download] GeSHi © Codebox Plus

w::SendInput w ;Sends "instantly" instead of waiting
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] [Download] GeSHi © Codebox Plus

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 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 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: 306
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Equestria

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] [Expand] [Download] GeSHi © Codebox Plus


This should suspend all keys before exiting. If this doesn't work, then uninstall and reinstall AHK. That's my best guess.
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:

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: 1041
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 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.
The more I know:
The more I know,
I know nothing.
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”

Who is online

Users browsing this forum: mast4rwang, Odlanir and 45 guests