单击鼠标右键并按下Q按钮并释放鼠标右键时,有人可以帮我使用AutoHotKey Macro按下并释放Q按钮吗?
编辑:
解释,想象一下,我正在玩游戏,当我点击鼠标右键(然后我按住它)我需要在键盘上按下Q字母,所以我会得到一个跳跃(或蹲下) )在那个时候的游戏中,当我释放鼠标右键(鼠标按钮向上)时,我会再次按下Q键。
我试图编写脚本,但我无法正常工作。
这是我到目前为止所得到的:
RButton::
If !Toggler {
Send, {RButton Down} q
Return
}
Send {RButton Up} q
Return
答案 0 :(得分: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::
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的原始提示!
#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
答案 1 :(得分:1)