Code: Select all
;(1) Check if key has been pressed thrice, if so, disable hotkey for 5 seconds
;(2) Check if key has been pressed twice
;(3) Execute windows screenshot hotkey and Gsplit function after waiting 1 second
TheKey:
SetTimer, TheKey, off
quickclicks = 1
SetTimer, TheKey, 579
Return
$XButton2::
; [b](1)[/b]
if quickclicks > 0 ; [b]returns an error: >> "this variable has not been assigned a value"[/b]
{
quickclicks += 1
Return
}
; [b](2) [/b]
if A_PriorHotkey <> $XButton2
{
KeyWait, XButton2
return
}
if A_TimeSincePriorHotkey > 400
{
KeyWait, XButton2
return
}
; [b](3)[/b]
Send, #{PrintScreen}
Sleep, 1000
Gsplit()
Return
if quickclicks >= 3
{
msgbox, Key got clicked thrice
hotkey, XButton2, off ; disable mouse hotkey for 1 Minute
Sleep 5000
hotkey, XButton2, on ; enable mouse hotkey
}
quickclicks = 0
Return
Gsplit()
{
msgbox, Key got clicked twice
}