Prevent triggering and buffering

Get help for the alpha version of AutoHotkey v2 here. Please state the v2 version you are working with in the title when making a new topic.
stretch65
Posts: 8
Joined: 16 Jun 2015, 23:49

Prevent triggering and buffering

12 Oct 2020, 03:53

Say I have 2 hot keys defined. For example:

Code: Select all

$m:: {
  keywait "m"
}

$a:: {
  keywait "a"
}
If I hold down "m" then $m:: is obviously triggered. If, while I'm holding "m" down, I press "a" then $a:: interrupts $m:: . When "a" is released, $m:: resumes until it's released as well.
Now what I want is for the script to totally ignore $a:: while I'm holding down "m". In other words, I don't want it triggered OR buffered. How would I do that?

I've tried increasing the thread priority inside of $m::, but $a:: still triggers, so I'm not sure what to do.
Last edited by gregster on 12 Oct 2020, 04:07, edited 1 time in total.
Reason: Moved to 'Ask For Help'.
User avatar
boiler
Posts: 6650
Joined: 21 Dec 2014, 02:44

Re: Prevent triggering and buffering

12 Oct 2020, 06:21

Make the a hotkey conditional on the state of the m key using #HotIf:

Code: Select all

$m:: {
  keywait "m"
}

#HotIf !GetKeyState("m", "P")
$a:: {
  keywait "a"
}

Return to “AutoHotkey v2 Help”

Who is online

Users browsing this forum: No registered users and 4 guests