我有一个特殊的鼠标按钮,用作双击。它没有任何特殊键,它只发送两个LButton信号。
我已将#InstallMouseHook引入我的脚本中,以便能够跟踪鼠标点击。多次按下双按钮后我得到了这个:
VK SC Type Up/Dn Elapsed Key
---------------------------------------------------------------------------------------
04 000 d 2.78 MButton
04 000 u 0.19 MButton
01 000 d 0.65 LButton <- Manual DC
01 000 u 0.17 LButton
01 000 d 0.11 LButton
01 000 u 0.14 LButton
04 000 d 0.75 MButton
04 000 u 0.19 MButton
01 000 d 0.45 LButton <- Special button DC
01 000 u 0.00 LButton
01 000 d 0.00 LButton
01 000 u 0.00 LButton
从我的假设中,经过的键是确定DC鼠标按钮的双击(DC)的关键,以及我手动按下左键两次的键。我想重新映射前一个场景,而不是后者(DC按钮::其他类似中间点击和我的手动双击左键保持不变)。到目前为止,DC按钮的经过时间似乎<2.0且手动DC> 2.0。
这个想法是有这样的东西(不是用AHK语言):
loop
if (LButton == 1) //pressed
{
t=StartElapseTimer;
if (t<2 && LButton == 1) //how to check it went down and up before down the 2nd time?
LButton::MButton; //the remapping I want
else // t>2
Nothing //let me do a regular DC
}
end
您能帮助我了解如何启动计时器以及需要设置哪些环境变量?
感谢。
答案 0 :(得分:0)
每次点击,您必须检查自上次点击以来经过的时间并决定如何处理信息:
dcTime := 50
LButton::
if(A_PriorHotkey = A_ThisHotkey && A_TimeSincePriorHotkey < dcTime) {
Send, {MButton}
} else {
Send, {LButton}
}
return
当然,您必须根据鼠标按钮的速度调整超时。我还建议调用SetBatchLines, -1
,因为它可以最大限度地减少时间测量中的不准确性。