; ; Functions for holding and repeating keys ; _TurboOn := [] Hold(Primary, Secondary) { Send {%Primary% down} if ( Secondary.Length() != 0 ) { ThisLoop := Func("HoldLoop").bind(Primary,Secondary) SetTimer, %ThisLoop%, 50 } } HoldLoop(Primary, Secondary) { if GetKeyState(Primary,"P") { SetTimer, , Delete return } for index,key in Secondary { if GetKeyState(key,"P") { Send,{Blind} {%Primary% up} SetTimer, , Delete return } } } Repeat(Primary, Secondary) { Send,{Blind} {%Primary% up} Sleep 100 RepeatVar := 0 Loop { if GetKeyState(Primary,"P") { return } for index,key in Secondary { if GetKeyState(key,"P") { return } } if (RepeatVar == 1) { Send,{Blind} {%Primary% down} RepeatVar := 0 } else { Send,{Blind} {%Primary% up} RepeatVar := 1 } Sleep 100 } } ; 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) { Repeat(Primary,Secondary) } else { Hold(Primary,Secondary) } } ; Press Target button extremely rapidly while Hold button is held down Turbo(Target,Hold) { global _TurboOn If (_TurboOn["%Target%_%Hold%"]) { return } else { _TurboOn["%Target%_%Hold%"]:=1 While GetKeyState(Hold,"P") { Send,{Blind} {%Target% down} Sleep 25 Send,{Blind} {%Target% up} Sleep 25 } _TurboOn["%Target%_%Hold%"]:=0 } }