*j::{ global Glue if (!Glue) { Glue:=true SendInput "{d}" Sleep 1 } SendInput "{8}" SendInput "{7 DownR}" } *j up::{ SendInput "{7 Up}" } Cycle:="" *x::CycleOn("x") *v::CycleOn("v") *rbutton::CycleOn("rbutton") *xbutton1::CycleOn("xbutton1") *x up::CycleOff("x") *v up::CycleOff("v") *rbutton up::CycleOff("rbutton") *xbutton1 up::CycleOff("xbutton1") CycleOn(key) { global Cycle, Stack, Glue if (InStr(Cycle,key,true)) { return } SendInput "{d}" Cycle.=key Stack.="S" SendInput "{" Key "}" len:=StrLen(Cycle) if (len == 2) { while (StrLen(Cycle) >= 2) { if (!StrLen(StrReplace(Stack,"S","",true)) && !Glue) { loop parse Cycle { SendInput "{" A_LoopField "}" } } Sleep 100 } if (!Glue) { lastChar:=SubStr(Stack, -1) if (lastChar == "S") { loop parse Cycle { SendInput "{" A_LoopField "}" } } } } else if (len == 1) { SendInput "{7 DownR}" } } CycleOff(key) { global Cycle, Stack Cycle:=StrReplace(Cycle,key,"",true) lastChar:=SubStr(Stack, -1) pos_S:=InStr(Stack,"S",true,-1) if (pos_S) { Stack := SubStr(Stack,1,pos_S-1) SubStr(Stack,pos_S+1) } lastLast:=SubStr(Stack, -1) if (!Cycle && !Stack) { SendInput "{7 Up}" } if (lastChar == "S" && lastLast && lastLast!=="S") { SendInput "{" lastLast "}" } } Stack:="" *q::StackOn("q") *e::StackOn("e") *r::StackOn("r") *3::StackOn("3") *4::StackOn("4") *f::StackOn("f") *q up::StackOff("q") *e up::StackOff("e") *r up::StackOff("r") *3 up::StackOff("3") *4 up::StackOff("4") *f up::StackOff("f") StackOn(key) { global Stack if (InStr(Stack,key,true)) { return } Stack.=key SendInput "{d}" SendInput "{" Key "}" SendInput "{7 DownR}" } StackOff(key) { global Stack, Cycle lastChar:=SubStr(Stack, -1) Stack:=StrReplace(Stack,key,"",true) lastLast:=SubStr(Stack, -1) if (!Cycle && !Stack) { SendInput "{7 Up}" } if (lastChar == key && lastLast) { loop parse StrReplace(lastLast,"S",Cycle,true) { SendInput "{" A_LoopField "}" } } } #SuspendExempt 5::Suspend #SuspendExempt False