Run hotkey only on keydown, not hold (KeyWait not working)

Get help with using AutoHotkey and its commands and hotkeys
Posts: 1
Joined: 19 Feb 2018, 14:09

Run hotkey only on keydown, not hold (KeyWait not working)

19 Feb 2018, 14:23

I'm trying to get a hotkey to only fire on keydown and not to fire repeatedly when held down. I can use KeyWait to accomplish this, but the problem is, KeyWait seems to have a bug that makes it not function correctly when you press two hotkeys at the same time that both have KeyWait. For example, try this script:

Now, do the following:

1. hold `d`
2. without releasing `d`, also hold `a`
3. release `d` while still holding `a`

The result will be that even though you've released the `d` key, the KeyWait will not fire and R will not be sent. When you also release the `a` key, it then fires BOTH KeyWaits at the same time.

If you remove the KeyWait from the `a` hotkey and keep it in the `d` hotkey, then it sends R immediately when you release it, even if you're holding `a`. Thus I can conclude that there is some problem with the KeyWait function where it has issues if two KeyWaits are active at the same time.

This is causing all sorts of problems with my script, since I have a lot of hotkeys with KeyWait in them to prevent them from firing repetitively if held.

So my question is, is there another way to prevent a hotkey from firing repetitively if held? Or perhaps is there a way to fix this problem with KeyWait?

Return to “Ask For Help”

Who is online

Users browsing this forum: No registered users and 56 guests