Jump to content
Sign in to follow this  
r4v3nz

Need help fixing script please!

Recommended Posts

r4v3nz

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 =/

$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

Share this post


Link to post
Share on other sites
omikron48

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.

Share this post


Link to post
Share on other sites
MuffettsMan

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!

Share this post


Link to post
Share on other sites
jaberwacky

$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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.