Hotkey overrides

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Micromegas
Posts: 195
Joined: 28 Apr 2015, 23:02
Location: Germany

Hotkey overrides

15 Mar 2019, 06:37

If there are two scripts that act on the same hotkey, say good.ahk = x::MsgBox Goodstuff and better.ahk = x::MsgBox Betterstuff, is there a way to assure that one has higher priority, that is, if both are running the hotkey always triggers Betterstuff, regardless which was started first?

Since I know which scripts the hotkeys are defined in, I can think of something like the following - although the changes would need to be written in the underriding script:
① Conditionally disable hotkey with #IfWinNotExist. Problem: I would need the directive to be dynamic, since the other script's state (whether it's running, paused or suspended) can change at runtime.
WinExist(). Problem: This doesn't simply allow disabling a hotkey as is possible with the directive #IfWinNotExist.
Moreover, both require DetectHiddenWindows, On, which is not recommended. (“… most scripts should leave this setting turned off.”)
IMEime
Posts: 735
Joined: 20 Sep 2014, 06:15

Re: Hotkey overrides

15 Mar 2019, 06:44

.
Last edited by IMEime on 16 Mar 2019, 12:03, edited 2 times in total.
User avatar
Micromegas
Posts: 195
Joined: 28 Apr 2015, 23:02
Location: Germany

Re: Hotkey overrides

16 Mar 2019, 11:22

Does anyone know a way to assign priority, regardless which was run first?
(The two scripts run in the same window, so #IfWinActive won't help.)

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], sinkfaze, wdscxsj and 66 guests