首页 > 解决方案 > 自动热键 3 次点击 = 静音

问题描述

在自动热键中,我试图做到这一点,以便当我按鼠标左键 3 次并延迟+/- 10 毫秒时,它会变成音量静音

LButton::
if (?) 
{
     Send, Volume_Mute
}
else 
{
     Send, LButton
}
Return

标签: autohotkey

解决方案


用于A_TickCount以毫秒为单位读取当前时间,然后计算点击之间的延迟。查看日期和时间

ms := A_TickCount
N := 3          ; number of clicks
T := 500        ; max delay between clicks, ms
clicks := 0

~lbutton::
    msx := A_TickCount      ; get current time
    d := msx - ms           ; get time past
    ms := msx               ; remember current time
    if (d < T) 
        clicks += 1
    else 
        clicks := 1
    if (clicks >= N) 
    {
        ; tooltip %N%-click detected 
        send {Volume_Mute}
        clicks := 0
    }
return

推荐阅读