如何输入(持LButton)?

时间:2013-01-08 08:59:44

标签: autohotkey

我正在尝试(按住左键1秒)使其右键单击。这就是我得到的:

 LButton::
    MouseClick, right, , , 1, 0, D
    Sleep 0
    MouseClick, right, , , 1, 0, U
return

如何将“LButton”输入更改为“Hold LButton 1秒”?

2 个答案:

答案 0 :(得分:1)

这个怎么样......

LButton::
StartTime := A_TickCount ; Set the timer
KeyWait, LButton ; Wait for release of mousebutton
ElapsedTime := A_TickCount - StartTime ; Calculate elapsed time
if (ElapsedTime > 1000)
    Click, Right ; when longer than 1000 ms
    Click, Left  ; when shorter than 1000 ms
return

缺点是您不能将鼠标用于例如突出显示文字......

答案 1 :(得分:0)

你走了:

#Persistent 
#SingleInstance Force
#NoEnv
SetBatchLines, -1

global timeDown = 0

SetTimer, checkLeftClick,25

checkLeftClick:
    if(  GetKeyState("LButton" , "P") )
    {
        timeDown += 25
    }
    else
    {
        timeDown = 0
    }

    if(timeDown > 1000)
    {
        MouseClick , left , , , , ,U
        Click,Right
        timeDown = 0
    }

return