Jump to content

Restart Script On Error


Recommended Posts

I have a script that uses the IE.au3 include and now and then it will get random errors, rather from internet connection hiccup, an unencountered page I haven't accounted for, random webpage glitches from IE, or random errors from within IE.au3 itself.

How can I make it so that no matter what error occurs, it will close all iexplore.exe processes and start over from Line 1.

Link to comment
Share on other sites

I have a script that uses the IE.au3 include and now and then it will get random errors, rather from internet connection hiccup, an unencountered page I haven't accounted for, random webpage glitches from IE, or random errors from within IE.au3 itself.

How can I make it so that no matter what error occurs, it will close all iexplore.exe processes and start over from Line 1.

I'm not completely sure if this will do what you want, but try this function OnAutoItExit (look for it in the helpfile).

Also: #199608

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Not sure if this will help, but could you place what you want to execuite inside of a loop then @error exitloop. Now I am a complete newb with autoit but I find that trying to help might just help me learn the code better as well.

Func ieactive()

while 1

$iexplorer = ProcessExists("iexplorer.exe")

If $iexplorer = 0 Then
 call(restarter)
Endif

wend

EndFunc

Func restarter()

Runwait("Iexplorer.exe")
sleep(3000)
call(ieactive)
endfunc
Link to comment
Share on other sites

IE has its own error handler included :

_IEErrorHandlerRegister("MyErrFunc")

Func MyErrFunc()
    $oError =$oIEErrorHandler.description
EndFunc

Then you can check $oError and depending on the description take different actions.

You can ever start the script a second time and exit the current script that is what you mean by "tart over from Line 1"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...