Autohotkey 如果点击鼠标,做一件事,如果按住鼠标,做正常的事

Autohotkey 如果点击鼠标,做一件事,如果按住鼠标,做正常的事,autohotkey,Autohotkey,我希望我的代码能够注册鼠标是否被点击,并在点击时执行某些操作,但也能够注册鼠标是否被按下,如果是这种情况,则不会中断鼠标被按下。比如说, If AutoCAD is open If mbutton is clicked click the escape key If mbutton is held down be able to use the mbutton held down as usual E

我希望我的代码能够注册鼠标是否被点击,并在点击时执行某些操作,但也能够注册鼠标是否被按下,如果是这种情况,则不会中断鼠标被按下。比如说,

    If AutoCAD is open
        If mbutton is clicked
            click the escape key
        If mbutton is held down
            be able to use the mbutton held down as usual
    End
我试过几种不同的方法来做这件事,但我不知道怎么做。我得到了“如果AutoCAD打开”和“单击escape键”的部分,而不是“如果按住该部分,则正常使用mbutton”


谢谢你能提供的任何帮助

如果我理解正确,您正在搜索
UP
关键字:

在热键的名称后面可能会出现UP一词,以使热键 释放钥匙而不是按下钥匙时点火

()


这有点棘手。相应地更改
#IfWinExist
行。你可以将持续时间调整为你认为“持有”MButton


你为什么不提供你已经得到的代码给我们?这个脚本在按住MButton后仍然会发送Escape。好吧,我理解OP的方式,他希望这样。你可能是对的。
#if autocad()
MButton Up::
send {escape}
return
#if

autocad() {
    return true
}
SetTitleMatchMode, 2

#IfWinExist AutoCAD

~MButton::
    duration := 100
    start := A_TickCount

    While(GetKeyState("MButton"))
    {
        if ((A_TickCount - start) > duration)
        {
            KeyWait, MButton
            Send {MButton Up}
            Return
        }
    }
    Send, {Escape}
    Return

#IfWinExist AutoCAD