【发布时间】:2018-02-01 16:32:23
【问题描述】:
我正在尝试制作一个脚本,在按住 LButton 特定时间后按下 RButton 并忽略左键单击。我不知道该怎么做。
伪代码:
timer = 0;
while(LButton down){
add 1 to timer?
if(timer==100){
Send {RButton}
ignore LButton
reset timer
}
}
【问题讨论】:
标签: autohotkey
我正在尝试制作一个脚本,在按住 LButton 特定时间后按下 RButton 并忽略左键单击。我不知道该怎么做。
伪代码:
timer = 0;
while(LButton down){
add 1 to timer?
if(timer==100){
Send {RButton}
ignore LButton
reset timer
}
}
【问题讨论】:
标签: autohotkey
使用 A_TickCount 作为衡量时间流逝的一种快速简便的方法。
(已测试)
LButton::
StartTime := A_Tickcount
WaitTimeInMilliSeconds = 1000
tooltip trying
while(StartTime+WaitTimeInMilliSeconds > A_Tickcount)
{
if(!GetKeyState("LButton","P"))
{
click ;send the click anyway if it's not held.
return
}
}
tooltip this happens after 1000 milli second of continuously holding left mouse button
return
如果你把它放在鼠标左键热键中,它会自动重置。如果你想让它一直循环,你可以把整个东西放在一个无限循环中并重置开始时间而不是return
【讨论】:
LButton:: 前面放一个 ~ 。这使得点击“通过”,所以它正常点击并触发热键。