ayatest Posted January 24, 2015 Share Posted January 24, 2015 Let say that I have a script with some functions and some actions like below. (it will use mouseclicks as it is now, keyboard shortcuts, and maybe something else). Func test() ; test to repeat in various states MouseClick("left",734,75,1) Sleep(2000) MouseClick("left",763,76,1) Sleep(2000) EndFunc ; state 1 test() ; state 2 MouseClick("left",104,76,1) Sleep(2000) test() At the moment, steps are separated by time based pauses. What I'd like to do (and I'd like to make it work in called functions and outside them in the script) - is to use (with or instead of "sleep") a single hotkey, to trigger manually each next step (mouseclick, sent key, etc). So at least such step by step routine. What also would be useful, would be to have: - two keys to: shut down the script and pause the script - a key to repeat (retrigger) last step (optional) Could someone post an example how to wire such thing (if it's possible to wire it in autoit) with example above? (yes, I tried to wire terminate/pause part according to wiki, but for some reason it did not worked) functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general. Link to comment Share on other sites More sharing options...
pcjunki Posted January 24, 2015 Share Posted January 24, 2015 what's the name of the game your working on? Link to comment Share on other sites More sharing options...
ayatest Posted January 24, 2015 Author Share Posted January 24, 2015 It's not game, it's functional testing and multimedia recording. functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general. Link to comment Share on other sites More sharing options...
JohnOne Posted January 24, 2015 Share Posted January 24, 2015 (edited) That's a lot to ask for. You can find some pause functions >here. here is one possible way to repeat the last step, may not be the best but it's the first way I thought of as I don't generally use functions in this manner. It is minimalistic. #include <Array.au3> Global $aFuncs[3] = [_Func1, _Func2, _Func3] Global $RepeatLastStep _ArrayShuffle($aFuncs) $aFuncs[0]($aFuncs[0]) $aFuncs[1]($aFuncs[1]) $aFuncs[2]($aFuncs[2]) $RepeatLastStep($RepeatLastStep) Func _Func1($func) ConsoleWrite("Func 1" & @LF) $RepeatLastStep = $func EndFunc Func _Func2($func) ConsoleWrite("Func 2" & @LF) $RepeatLastStep = $func EndFunc Func _Func3($func) ConsoleWrite("Func 3" & @LF) $RepeatLastStep = $func EndFunc Edited January 24, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted January 24, 2015 Share Posted January 24, 2015 (edited) Using Hotkeys Native HotkeySet cannot handle function parameters, so need to alter the code slightly. #include <Array.au3> HotKeySet("^1", "_Func1") HotKeySet("^2", "_Func2") HotKeySet("^3", "_Func3") HotKeySet("^4", "_RepeatLastStep") Global $aFuncs[3] = [_Func1, _Func2, _Func3] Global $RepeatLastStep _ArrayShuffle($aFuncs) While 3 Sleep(333) WEnd Func _RepeatLastStep() If Not IsFunc($RepeatLastStep) Then Return ConsoleWrite("Repeating ") $RepeatLastStep() EndFunc Func _Func1() ConsoleWrite("Func 1" & @LF) $RepeatLastStep = _Func1 EndFunc Func _Func2() ConsoleWrite("Func 2" & @LF) $RepeatLastStep = _Func2 EndFunc Func _Func3() ConsoleWrite("Func 3" & @LF) $RepeatLastStep = _Func3 EndFunc EDIT: alter _RepeatLastStep function, due to error if called first. Edited January 24, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ayatest Posted January 25, 2015 Author Share Posted January 25, 2015 Well - I thought there will be some sort of a simple 1-command switch, like "sleep" (a sort of standard debugging routine). Thanks, I will look into it, and let you know. functional testing. multimedia recording. flowstone. mouseclick, hotkeys and modularity in general. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now