AutoHotKey v2.0 定義快捷鍵

heguo發表於2024-03-12

;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
}
}
}


}

相關文章