/lib/PlayMacro.ahk
AutoHotKey | 30 lines | 27 code | 3 blank | 0 comment | 5 complexity | 414a5a376c12336993707a36414ecb2f MD5 | raw file
1PlayMacro(macro) { 2 global currentXml 3 static oXML := ComObjCreate("MSXML2.DOMDocument") 4 oXML.async := False 5 oXML.Load(currentXml) 6 7 text := oXml.selectSingleNode("/profile/macros/" . macro . "/value").text 8 StringReplace, text, text, ``n, `n, all 9 10 Loop, Parse, text, `n 11 { 12 if (!A_LoopField) 13 Continue 14 else if (InStr(A_LoopField, "MouseMove")) 15 { 16 RegExMatch(A_LoopField, "O)MouseMove, (\d*?), (\d*)", match) 17 MouseMove, % match.1, % match.2, 1 18 } 19 else if (InStr(A_LoopField, "Sleep,")) 20 { 21 Send % sendString 22 sendString := "" 23 Sleep % SubStr(A_LoopField, 8) 24 } 25 else 26 sendString .= A_LoopField 27 } 28 Send % sendString 29} 30