Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Autohotkey 自动热键鼠标按钮组合_Autohotkey - Fatal编程技术网

Autohotkey 自动热键鼠标按钮组合

Autohotkey 自动热键鼠标按钮组合,autohotkey,Autohotkey,在Windows资源管理器中,我要执行以下操作: 当我按下并按住鼠标右键时: 自动热键等待鼠标左键单击 运行操作 当我按下但释放鼠标右键(正常右键单击)时: 运行普通Windows上下文菜单 问题在于鼠标按钮的按键状态。我想不出来。也许有人已经有了类似的脚本 #IfWinActive ahk_class CabinetWClass RButton:: Loop { GetKeyState, state, RButton if state = D KeyWait, LButt

在Windows资源管理器中,我要执行以下操作:

当我按下并按住鼠标右键时: 自动热键等待鼠标左键单击 运行操作

当我按下但释放鼠标右键(正常右键单击)时: 运行普通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

也许还有一件事。到目前为止,我需要先在浏览器中用鼠标左键在脚本前标记文件。你能想出一种方法,将鼠标悬停在文件上,然后右键单击运行脚本,它也会在删除之前标记文件吗?对不起,它实际上会这样做;)我的错