After calling ExitApp, key within rebind script stops working.

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Sashraan
Posts: 1
Joined: 29 Mar 2024, 09:25

After calling ExitApp, key within rebind script stops working.

Post by Sashraan » 29 Mar 2024, 09:47

Hello everybody!

I've had an issue ever since rebinding my Right arrow key (temporarily) to Insert.

The keyboard I have is a TH96 from Epomaker.

Once the script containing the two lines below is closed, the right arrow key stops working. It does not output Right again :

~Right::Insert
Esc::ExitApp

I've changed Insert for Up, and it works as intended when the script is running, however the moment ExitApp is called by pressing Escape, the Right arrow key fully stops sending any input when pressed on it's own. If CTRL or Shift is held, it outputs just fine, so it's specifically the "default" Right key that feels like it's still in the grasp of AHK or something after exiting the script...

I've tried to rebind the key to itself (using ~Right::Right) and it does the same thing. CTRL/Shift + Right works, solo Right doesn't.

Anybody got an explanation for this? I've seen two posts, one here one on StackExchange, and the StackExchange user "fixed it" by getting a new keyboard.... which is NOT a fix.. and this thread only has 6 different ways of saying "lol just exit the script" when that's been stated not to fix it.

For the record, I've checked task manager, my system tray, all of it, it's all closed and I've built in an ExitApp to ensure AHK closes itself, have rebooted, have tried unplugging and replugging my keyboard, all to no avail.

It would be nice to understand how an AHK remap script can affect a key after ExitApp is called... I was always told that AHK does not affect firmware or hardware, but clearly something weird is happening if my Right arrow key is still blocked without active scripts, right? ^^'

gregster
Posts: 9035
Joined: 30 Sep 2013, 06:48

Re: After calling ExitApp, key within rebind script stops working.

Post by gregster » 29 Mar 2024, 10:20

Sashraan wrote:
29 Mar 2024, 09:47
It would be nice to understand how an AHK remap script can affect a key after ExitApp is called...
It can't. It's simply not capable of doing that. Especially, it does nothing to change anything in your keyboard - so another keyboard would not change anything (if the keyboard is not actually broken).

We have had people here who had temporarily forgotten that they also tried other tools (like eg KeyTweak or the Keyboard Manager of MS Powertoys) and had remapped a key via the registry with their help. By removing that registry entry, they could solve their problem. This is a change which would persist after a reboot and without a specific tool running. (But a different keyboard would not help either.)
Probably you could also do smth like this with AHK's RegWrite but a remapping or hotkey would never do that by itself.

User avatar
boiler
Posts: 16986
Joined: 21 Dec 2014, 02:44

Re: After calling ExitApp, key within rebind script stops working.

Post by boiler » 29 Mar 2024, 10:49

Regarding unplugging and pugging back in a keyboard to reset it -- if you happen to have a keyboard that has firmware/flash memory that stores key re-mappings, then unplugging it and plugging it back in would not typically restore it to its default state. You would have to take specific actions to restore/reset the onboard settings file(s) to its (their) original state. And those setting changes are not made by simply running an AHK script that does AHK-level re-mappings as gregster indicated. The script would have to interface with your keyboard's onboard memory, which is unlikely to have occurred because that is typically accomplished using software provided by the keyboard manufacturer as it is unique to their hardware. If you are not aware of whether your keyboard has that capability, then it probably doesn't. If it does have that capability, and you perhaps did change its settings, then trying a different keyboard would isolate that as the issue.

Post Reply

Return to “Ask for Help (v2)”