I have function that is called every 5 seconds (via SetTimer) that checks if the belonging .ini file was modified and if yes, rereads the values.
The (de-) registration of the hotkey takes place inside that function
E.g.:
Code: Select all
GetIniFileValues(file) {
static iniLastHotkey := ""
iniHotkey := IniRead(file, "General", "Hotkey", "")
if (iniHotkey = "")
iniHotkey := "^Q"
if (iniLastHotkey != "" && iniHotkey != iniLastHotkey) {
Hotkey iniLastHotkey, Hotkey_ShowGui, "Off"
}
Hotkey iniHotkey, Hotkey_ShowGui, "On"
iniLastHotkey := iniHotkey
; ... do more stuff
}
Code: Select all
[General]
; The hotkey to invoke the drop-down menu
; # = Win
; ! = Alt
; ^ = Ctrl
; + = Shift
; Default = ^Q (Ctrl+Q)
Hotkey=^Q
Code: Select all
Hotkey_ShowGui(ThisHotkey) {
if (WinActive("ahk_class " C["DialogClass"]) {
; ... do stuff
}
return
}
HotIf WinActive("ahk_class " C["DialogClass"])
I just can't get it to work...