如何添加切换功能到AutoHotkey脚本?



我有一个AutoHotKey脚本,我想添加一些条件行为的脚本。例如,在下面的脚本中,发送"8">而不是"7"如果用户在发送键时按住鼠标2:

f::
Send {p down}  
Sleep 200  
Send {p up}
sleep, 899
Send, 7
return
2::
Send {o down}  
Sleep 200  
Send {o up}
Send, 7
sleep, 899
Send, 7
return
capslock::suspend
return

我如何切换脚本的行为,以便它根据脚本执行时的鼠标状态做一些不同的事情?这样的事情可能发生吗?

f::
If GetKeyState( "RButton", "P" )
var = 8
else
var = 7
Send {p down}
Sleep 200
Send {p up}
sleep, 899
Send, %var%
return
2::
If GetKeyState( "RButton", "P" )
var = 8
else
var = 7
Send {o down}
Sleep 200
Send {o up}
Send, %var%
sleep, 899
Send, %var%
return
capslock::
suspend
return

最新更新