Hi all! I have a very simple script that I am utilising that simply loops an action when I hit a button until it gets pressed again:
However, if I accidentally or otherwise hold down the X key, it'll keep sending the action and will no longer stop when I hit X again. I'd be very grateful if someone could point me in the direction of how to fix this.
How to stop a hotkey firing if held?
-
- Posts: 7
- Joined: 15 Jun 2014, 10:08
How to stop a hotkey firing if held?
Last edited by BaconCatBug on 18 Jul 2014, 13:41, edited 1 time in total.
Re: How to stop a hotkey firing if held?
Checkout GetKeyState to see if you can implement. Let us know if you get stuck.
-
- Posts: 7
- Joined: 15 Jun 2014, 10:08
Re: How to stop a hotkey firing if held?
Thanks for the help!fischgeek wrote:Checkout GetKeyState to see if you can implement. Let us know if you get stuck.
I eventually found a solution with Google-fu that uses SetTimer instead:
Code: Select all
#NoEnv
#SingleInstance, Force
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTimer TimerName, 1000
X::
Toggle := !Toggle
TimerName:
If (!Toggle)
Return
send ABC{space}
return