Chris
Chris

Reputation: 11

AHK using three or more key presses to trigger hotkey/hotstring

I know this question has been discussed before (several years ago). I am hoping there is a new way to achieve this goal. I would simply like to use three or more keys to trigger an AHK script. For example, CTRL + SHIFT + Q to do a thing

In "fake" ahk, this would be

^+Q:: ... return

Of course, this type of command errors. The previous solution is quite verbose compared to the task and involves checking the state of some key etc. Is there a shorthand way of accomplishing this?

Upvotes: 1

Views: 627

Answers (1)

PGilm
PGilm

Reputation: 2312

Please describe the error you get. The example you give does not produce an error for me.

But for one thing, a shift modifier on "Q" has no add'l effect (a Shift on "q" gives "Q").

But in the meantime, AHK is quite forgiving and any of these work:

^+Q::
    msgbox %A_ThisHotkey%
return

^Q::
    msgbox %A_ThisHotkey%
return

^+q::
    msgbox %A_ThisHotkey%
return

And in general two or even three modifier keys (Ctrl+Alt+Shift) is quite normal in practice. if you want two or more non-modifier keys, you will have to track key state. I guess you know that from your reference to what was "discussed before (several years ago)."

Upvotes: 0

Related Questions