好的,看起来您想要切换行为。
#SingleInstance Force
#installKeybdHook
#Persistent
SetTitleMatchMode, 2 ; Make search title in #IfWinActive more flexible
#IfWinActive, Title of your game as found by AHK Windows Spy
RButton::
If (Toggler := !Toggler )
{
ToolTip, RButton Down
Send, {RButton Down} q
Return
}
ToolTip, RButton Up
Send {RButton Up} q
Return
#IfWinActive
Return
*x::
ExitApp
更新
在阅读了您的文本(并忽略了您想要切换行为的脚本)之后,我认为您想要这个!RightClick
将发送RightClick Down + q
,然后什么都没有,直到您放开RightClick
,然后发送一个RightClick Up + q
. 我添加了工具提示,因此您可以查看#IfWinActive 是否正确激活了脚本。
#SingleInstance Force
#installKeybdHook
#Persistent
SetTitleMatchMode, 2 ; Make search title in #IfWinActive more flexible
#IfWinActive, Title of your game as found by AHK Windows Spy
RButton::
ToolTip, RButton Down + q
Send, {RButton Down} q
Return
RButton Up::
ToolTip, RButton Up + q
Send, {RButton Up} q
Return
#IfWinActive
Return
*x::
ExitApp
如果这确实是您想要的,那么最终的解决方案将非常接近 Armin 的原始提示!
更新 2,替代方式
#SingleInstance Force
#installKeybdHook
#Persistent
SetTitleMatchMode, 2 ; Make search title in #IfWinActive more flexible
#IfWinActive, Title of your game as found by AHK Windows Spy
*~RButton:: ; ~ passes Rbutton through
ToolTip, RButton Down + q
Send, q
KeyWait, RButton ; Wait for RButton to be released
ToolTip, RButton Up + q
Send, q
Return
#IfWinActive
Return
*x::
ExitApp