在Windows资源管理器中,我想执行以下操作:
当我按下并按住鼠标右键时:自动热键等待鼠标左键单击运行操作
当我按下但释放鼠标右键(正常右键单击):运行正常的窗口控制菜单
问题出在鼠标按钮的键状态中。我想不通。也许有人已经有了与此类似的脚本。
#IfWinActive ahk_class CabinetWClass
RButton::
Loop
{
GetKeyState, state, RButton
if state = D
KeyWait, LButton, D
send {Del}
if state = U
return
}
Click right
return
这就是我想出的。不工作:((
希望对您有所帮助。
#IfWinActive ahk_class CabinetWClass
RButton::
While GetKeyState("RButton", "P") ; while Rbutton is held down
if GetKeyState("LButton", "P") { ; if Lbutton is pressed
GoSub, LabelAction
Return
}
SendInput {RButton}
return
#IfWinActive
LabelAction:
msgbox, 64, % A_ThisLabel, Do some actions here.
Return
我认为
我对这个问题有更好的解决方案。在我看来,它更短更干净:
#IfWinActive ahk_class CabinetWClass
RButton & LButton::
Send {Del} ;or do whatever you want
return
RButton::
Send, {RButton}
return
编辑:
两年半后回顾这个答案,我现在意识到它可能会阻止右键单击文件,所以这可能是一个更好的选择,但我还没有测试过它:
#IfWinActive ahk_class CabinetWClass
~RButton & ~LButton::
Send {Del} ;or do whatever you want
return