Autohotkey 如何输入(按住按钮)?

Autohotkey 如何输入(按住按钮)?,autohotkey,Autohotkey,我试着做(按住左键1s)让它右键点击。以下是我得到的: LButton:: MouseClick, right, , , 1, 0, D Sleep 0 MouseClick, right, , , 1, 0, U return 如何将“LButton”输入更改为“Hold LButton 1秒”?这个如何 LButton:: StartTime := A_TickCount ; Set the timer KeyWait, LButton ; Wait for re

我试着做(按住左键1s)让它右键点击。以下是我得到的:

 LButton::
    MouseClick, right, , , 1, 0, D
    Sleep 0
    MouseClick, right, , , 1, 0, U
return
如何将“LButton”输入更改为“Hold LButton 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
缺点是你不能再使用鼠标来突出显示文本了……

这个怎么样

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
缺点是您不能再使用鼠标来突出显示文本等…

给您:

#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
给你:

#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

我猜你必须测量鼠标落下和鼠标上升之间的时间。嗯。。。tbh我不知道怎么做:(,实际上我从某处得到的脚本…一旦我发现如何执行基本的线程间通信,这应该很容易。将进行调查..我想你必须测量鼠标按下和鼠标上升之间的时间。嗯…tbh我不知道怎么做:(,事实上,我从某处得到的脚本…一旦我发现如何执行基本的线程间通信,这应该很容易。将调查。。