我想不通。
我正在尝试完成这样的事情:
当前工作:
Toggle=0
GUI, Add, Button, w50 h50, Nbutton
GUI, Show, x50 y50
return
ButtonNButton:
{
Toggle:=!Toggle
}
if GetKeyState("LButton","P")
if (Toggle == 1)
MsgBox, Do
Toggle:=!Toggle
return
答案 0 :(得分:0)
这应该可以完成您想要的。
请注意,目前,此示例脚本仅限于在记事本中使用。您应该更新脚本,以定位您希望热键处于活动状态的任何程序/游戏/窗口。
Toggle := 0
GUI, Add, Button, w50 h50, Nbutton
GUI, Show, x50 y50
return
ButtonNButton:
Toggle:=!Toggle
; Update this line to match whatever window you want the hotkey active
; in, or delete this line to make the hotkey active everywhere.
Hotkey, IfWinActive, ahk_class Notepad
if Toggle
{
Hotkey, ~*LButton Up, RBSwitch, On
}
else
{
if GetKeyState("RButton") ;release RButton when hotkey is disabled
Send {RButton Up}
Hotkey, ~*LButton Up, RBSwitch, Off
}
RETURN
RBSwitch:
if GetKeyState("RButton")
Send {RButton Up}
else
Send {RButton Down}
RETURN