r4v3nz Posted May 5, 2010 Share Posted May 5, 2010 This script run for 2-3 hours then I got an error:Line -1;Error: Recursion level has been exceeded - autoit will quit to prevent stack overflow.I need to make it run non stop =/expandcollapse popup$sumthing = IniRead(@ScriptDir & "\Config.ini", "Settings", "sumthing", "") sleep(500) WindowName() While sleep(500) wend Func WindowName() If WinExists($sumthing) Then nothing() else Processclose("kkchose1.exe") sleep(150) Processclose("kkchose2.exe") sleep(150) Run("anotherthing",@ScriptDir) sleep(1000) send("^s") sleep(2000) Run("kkchose2",@ScriptDir) sleep(250) LogEvent() EndIf endfunc Func LogEvent() $LogFile = FileOpen(@ScriptDir & "\Logs\kkchose3 restarter.txt", 1) FileWriteLine($LogFile, @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Oups kkchose3 crashed... Restarting") sleep(100) FileClose($LogFile) nothing() EndFunc Func nothing() sleep(5000) WindowName() Endfunc Link to comment Share on other sites More sharing options...
jaberwacky Posted May 5, 2010 Share Posted May 5, 2010 Well, instead of using recursion you may have to use some while loops... Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
omikron48 Posted May 5, 2010 Share Posted May 5, 2010 You shouldn't make functions call each other in a looping pattern, specially when you don't have a terminating condition. Just reorganize your script code so you don't have functions calling functions calling functions. In this case, I don't think you even need functions at all. Link to comment Share on other sites More sharing options...
MuffettsMan Posted May 5, 2010 Share Posted May 5, 2010 have you tried killing that nothing() function and just calling WindowName() every 5 seconds or so in your orig while loop? While 1 sleep(500) WindowName() wend ; .... Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
jaberwacky Posted May 5, 2010 Share Posted May 5, 2010 $sumthing = IniRead(@ScriptDir & "\Config.ini", "Settings", "sumthing", "") While 1 If Not WinExists($sumthing) Then ProcessClose("kkchose1.exe") Sleep(150) ProcessClose("kkchose2.exe") Sleep(150) Run("anotherthing", @ScriptDir) Sleep(1000) Send("^s") Sleep(2000) Run("kkchose2", @ScriptDir) $LogFile = FileOpen(@ScriptDir & "\Logs\kkchose3 restarter.txt", 1) FileWriteLine($LogFile, @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & " Oups kkchose3 crashed... Restarting") FileClose($LogFile) EndIf Sleep(500) WEnd Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? 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