AutoHotKey鼠标按下继续按一个键,直到鼠标向上

时间:2013-01-31 16:45:18

标签: autohotkey mousedown

我正在尝试制作一个脚本,让我可以继续按某个键,例如“1”,当我按住鼠标左键超过0.5秒时,我将继续按下鼠标左键。< / p>

希望有人可以帮助我。

1 个答案:

答案 0 :(得分:1)

你可以尝试这样的事情。我使用鼠标中键进行测试。

我注释掉了特定于应用程序的行。

SetTitleMatchMode, 2 ; Put at the top of your script.

MButton:: ; Start this script when the Middle Mouse Button is pressed
;ifWinActive, Your Application Name ; Place the application name as in the windows title.
;{
    KeyWait, MButton, T0.5 ; Wait for MButton to be released within 0.5 sec
    if  (ErrorLevel) ; Not released within 0.5 sec.
    {
        Send, {1 Down} ; Press 1 down, will not autorepeat unless placed in a while loop
        KeyWait, MButton ; Wait for Mbutton to be released
        Send, {1 Up} ; Once MButton is released, undo the press 1 down
    }
    else ; If MButton was released within 0.5 sec.
    {
        Click ; press click
    }
;}
;else
;{
;   Click ; perform normal click behaviour when outside of the target application
;}
Return