📜  ahk 切换热键 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:41.307000             🧑  作者: Mango

代码示例1
; old way
toggle := 0
;%A_ThisHotkey%M:=0
F1::
F2::
SoundBeep
%A_ThisHotkey%M ^= 1
if %A_ThisHotkey%M
MsgBox, This only shows when toggle is 1
Else
%A_ThisHotkey%M:=toggle
return

;new way
F3::
F4::
KeyNo:= RegExReplace(A_ThisHotkey, "\D")
if (%A_ThisHotkey%:= !%A_ThisHotkey%)
Tooltip, % A_ThisHotkey "on",,, KeyNo
Else
Tooltip, % A_ThisHotkey "off",,, KeyNo
Return