|
|
@ -2,32 +2,41 @@ |
|
|
|
; Functions for holding and repeating keys |
|
|
|
; |
|
|
|
|
|
|
|
_TurboOn := [] |
|
|
|
_TurboOn := Map() |
|
|
|
|
|
|
|
Hold(Primary, Secondary) { |
|
|
|
Send, {Blind}{%Primary% down} |
|
|
|
if ( Secondary.Length() != 0 ) { |
|
|
|
ThisLoop := Func("HoldLoop").bind(Primary,Secondary) |
|
|
|
SetTimer, %ThisLoop%, 50 |
|
|
|
} |
|
|
|
Hold(Primary, Secondary:=[],Tertiary:=[]) { |
|
|
|
Send "{Blind}{" Primary " down}" |
|
|
|
SetTimer HoldLoop.Bind(Primary,Secondary,Tertiary), 50 |
|
|
|
} |
|
|
|
|
|
|
|
HoldLoop(Primary, Secondary) { |
|
|
|
HoldLoop(Primary, Secondary, Tertiary) { |
|
|
|
if GetKeyState(Primary,"P") { |
|
|
|
SetTimer, , Delete |
|
|
|
SetTimer , 0 |
|
|
|
return |
|
|
|
} |
|
|
|
for index,key in Secondary { |
|
|
|
if GetKeyState(key,"P") { |
|
|
|
Send, {Blind}{%Primary% up} |
|
|
|
SetTimer, , Delete |
|
|
|
Send "{Blind}{" Primary " up}" |
|
|
|
SetTimer , 0 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
keyHeld:=0 |
|
|
|
for index,key in Tertiary { |
|
|
|
if GetKeyState(key,"P") { |
|
|
|
keyHeld:=1 |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if (!keyHeld) { |
|
|
|
Send "{Blind}{" Primary " up}" |
|
|
|
SetTimer , 0 |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Repeat(Primary, Secondary) { |
|
|
|
Send, {Blind}{%Primary% up} |
|
|
|
Send "{Blind}{" Primary " up}" |
|
|
|
Sleep 100 |
|
|
|
RepeatVar := 0 |
|
|
|
Loop { |
|
|
@ -40,10 +49,10 @@ Repeat(Primary, Secondary) { |
|
|
|
} |
|
|
|
} |
|
|
|
if (RepeatVar == 1) { |
|
|
|
Send, {Blind}{%Primary% down} |
|
|
|
Send "{Blind}{" Primary " down}" |
|
|
|
RepeatVar := 0 |
|
|
|
} else { |
|
|
|
Send, {Blind}{%Primary% up} |
|
|
|
Send "{Blind}{" Primary " down}" |
|
|
|
RepeatVar := 1 |
|
|
|
} |
|
|
|
Sleep 100 |
|
|
@ -52,9 +61,8 @@ Repeat(Primary, Secondary) { |
|
|
|
|
|
|
|
; Sets key to hold if single tap, or repeat if double tap |
|
|
|
HoldOrRepeat(Primary, Secondary) { |
|
|
|
Send, {Blind}{%Primary% down} |
|
|
|
KeyWait, %Primary%, D, T0.2 |
|
|
|
if (ErrorLevel = 0) { |
|
|
|
Send "{Blind}{" Primary " down}" |
|
|
|
if (KeyWait Primary, "D T0.2") { |
|
|
|
Repeat(Primary,Secondary) |
|
|
|
} else { |
|
|
|
Hold(Primary,Secondary) |
|
|
@ -62,18 +70,22 @@ HoldOrRepeat(Primary, Secondary) { |
|
|
|
} |
|
|
|
|
|
|
|
; Press Target button extremely rapidly while Hold button is held down |
|
|
|
Turbo(Target,Hold) { |
|
|
|
TurboOn(Target,Hold:=Target) { |
|
|
|
global _TurboOn |
|
|
|
If (_TurboOn["%Target%_%Hold%"]) { |
|
|
|
If (_TurboOn.Has(Target "_" Hold) and _TurboOn[Target "_" Hold]) { |
|
|
|
return |
|
|
|
} else { |
|
|
|
_TurboOn["%Target%_%Hold%"]:=1 |
|
|
|
While GetKeyState(Hold,"P") { |
|
|
|
Send, {Blind}{%Target% down} |
|
|
|
_TurboOn[Target "_" Hold]:=1 |
|
|
|
While _TurboOn[Target "_" Hold] { |
|
|
|
Send "{Blind}{" Target " down}" |
|
|
|
Sleep 10 |
|
|
|
Send, {Blind}{%Target% up} |
|
|
|
Send "{Blind}{" Target " up}" |
|
|
|
Sleep 10 |
|
|
|
} |
|
|
|
_TurboOn["%Target%_%Hold%"]:=0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
TurboOff(Target,Hold:=Target) { |
|
|
|
global _TurboOn |
|
|
|
_TurboOn[Target "_" Hold]:=0 |
|
|
|
} |