AutoHotKey v2.0 定义快捷键

;Win+方向键切换桌面

;F4键切换桌面

;鼠标扩展键单击关闭页签,双击关闭窗口

;今天测试通过,引起强烈的分享欲望

#Requires AutoHotkey v2.0

#n::Run("notepad.exe")
#Right::Next()
#Left::Next()
F4::Next()
XButton1::Close()


{
Next()
{
static index := 1
if (index == 2)
{
Send("#^{Left}")
index := 1
}
else
{
Send("#^{Right}")
index := 2
}
}

Close()
{
static dateTime1 := 0
static keyPressCount := 0
if keyPressCount == 0
{
DllCall("QueryPerformanceCounter", "Int64*", &Now := 0)
Send("^{F4}")
KeyPressCount := 1
dateTime1 := Now
}
else if keyPressCount == 1
{
DllCall("QueryPerformanceFrequency", "Int64*", &freq := 0)
DllCall("QueryPerformanceCounter", "Int64*", &Now := 0)
;MsgBox "Elapsed QPC time is " . (Now - dateTime1) / freq * 1000 " ms"
local span := (Now - dateTime1) / freq * 1000
dateTime1:=Now
if (span < 350)
{
Send("!{F4}")
keyPressCount := 0
}
else
{
Send("^{F4}")
KeyPressCount := 1
}
}
}


}

posted @ 2024-03-12 11:30  heguo  阅读(76)  评论(0编辑  收藏  举报