【问题标题】:How to input (Holding LButton)?如何输入(按住LButton)?
【发布时间】:2013-01-09 04:50:38
【问题描述】:

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

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

如何将“LButton”输入改为“Hold LButton for 1 seconds”?

【问题讨论】:

  • 我猜你必须测量鼠标按下和鼠标抬起之间的时间。
  • hmmm... tbh 我不知道该怎么做 :( ,实际上那个脚本我从某个地方得到的...
  • 一旦我了解了如何执行基本的线程间通信,这应该很容易。将调查..

标签: autohotkey


【解决方案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

缺点是您不能使用鼠标,例如不再突出显示文本...

【讨论】:

    【解决方案2】:

    给你:

    #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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-10
      • 2016-02-20
      • 2010-10-17
      • 2020-03-03
      • 1970-01-01
      • 1970-01-01
      • 2016-07-10
      • 1970-01-01
      相关资源
      最近更新 更多