我正在尝试使用热键LCTRL将XButton2切换到不同的模式。 问题在于它说同一个脚本中有重复的热键。我显然不知道发生了什么。帮助
~LCtrl::
actioncameratoggle := !actioncameratoggle
if actioncameratoggle
{
~XButton2::
rTurn := !rTurn
if rTurn
{
send {lctrl}
mousemove, 800, 450
send {ctrl}
mousemove, 1600, 450
}
else
{
}
}
else
{
~XButton2::
{
}
}
return
谢谢!
答案 0 :(得分:0)
使用您的脚本您无法使用相同的热键进行切换,原因是您希望将 if 与 Else 命令>一起使用if hotkey1:: else hotkey1::
,您需要 #if 命令。看看这个示例代码。
您可以编写此示例.ahk Code并在Windows系统上试用。
根据您的需要稍微更改一下代码,就完成了。
我确实制作了剧本,以便其他人可以简单地测试它。
; [+ = Shift] [! = Alt] [^ = Ctrl] [# = Win]
a := 1
#If mode1 ; All hotkeys below this line will only work if mode1 is TRUE or 1
t::1
; Here you can put your first hotkey code ~XButton2::
#If
#If mode2 ; All hotkeys below this line will only work if mode2 is TRUE or 1
t::2
; And here you can put your second hotkey code ~XButton2::
#If
; toggle between [t::1] and [t::2]
;a = 1 => t::1
;a = 2 => t::2
;type LCtrl key to toggle between two the same hotkeys
;you can test it out in notepad - if you then type the key t
~LCtrl::
if (a=1)
{
mode1 = 1
mode2 = 0
a := 2
}else{
mode1 = 0
mode2 = 1
a := 1
}