I need a help, in the script below I am trying to choose a hotkey and make it work while it is enabled, but I am encountering problem that I can not solve. I change the Hotkey and the previous one continues to function as if it were in memory, and I also can not activate the Hotkey that I chose earlier.
Code: Select all
Gui, +AlwaysOnTop
Gui, Add, Checkbox, y15 gActiveGHotkey, Activate to work!
Gui, Add, Text, y+10, Click here below and press a hotkey,`nclick outside the box and press the chosen hotkey:
Gui, Add, Hotkey, w250 vHotkeyChoose
Gui, Show, w270
return
toggle3 := 0
ActiveGHotkey:
toggle3 := !toggle3
if (toggle3) {
EnableVarOk := 1
MsgBox, You have activated the hotkey!
SetTimer, ActiveScriptHotkey, On
} else {
EnableVarOk := 0
MsgBox, You disabled hotkey!
SetTimer, ActiveScriptHotkey, Off
}
return
ActiveScriptHotkey:
Gui, Submit, NoHide
if (HotkeyChoose != "") {
Hotkey, %HotkeyChoose%, HotkeyGUse
}
return
HotkeyGUse:
if (EnableVarOk=1) and (HotkeyChoose != "") {
MsgBox, You press: %HotkeyChoose%
}
return
Esc::ExitApp
GuiClose:
ExitApp
[Mod note: Moved to "Ask for Help"]