Page 1 of 1

Restart iMacro on Error Possible?

Posted: Thu Sep 30, 2010 9:00 pm
by dombrorj
I'm using iMacros for form filling, and the site I'm using it on is kinda buggy and makes the iMacro fail sometimes. That basically means I have to sit and watch in case I have to restart the macro. Is there a way to make it auto-restart if there's an error?

Re: Restart iMacro on Error Possible?

Posted: Mon Oct 04, 2010 11:33 am
by Tom, Tech Support
Hello dombrorj,

You can call your macro from a script, check the return code for an error, and restart if necessary. For example...

Code: Select all

Dim im, ret
Set im = CreateObject("iMacros")
im.iimInit()

Do 
     ret = im.iimPlay("MyMacro")
     ' Exit the loop if the macro succeeds (1)
     ' or the user presses the Stop button (-101)
     If ret = 1 Or ret = -101 Then
          Exit Do
     End If
Loop
This will continually play your macro until it returns success (1). I wouldn't necessarily recommend this simplified approach however. It is usually better to test for specific errors and handle them accordingly.

Re: Restart iMacro on Error Possible?

Posted: Mon Oct 04, 2010 12:17 pm
by dombrorj
Thanks Tom. I didn't think of that - appreciate the tip!

Re: Restart iMacro on Error Possible?

Posted: Sat Aug 24, 2013 4:42 pm
by ChapoGuzman
Tom, iOpus wrote:Hello dombrorj,

You can call your macro from a script, check the return code for an error, and restart if necessary. For example...

Code: Select all

Dim im, ret
Set im = CreateObject("iMacros")
im.iimInit()

Do 
     ret = im.iimPlay("MyMacro")
     ' Exit the loop if the macro succeeds (1)
     ' or the user presses the Stop button (-101)
     If ret = 1 Or ret = -101 Then
          Exit Do
     End If
Loop
This will continually play your macro until it returns success (1). I wouldn't necessarily recommend this simplified approach however. It is usually better to test for specific errors and handle them accordingly.
Hi TOM,

How will I make that script do 2 things, loop back on error and if no errors then countine running the complete script and loop when the script is finish for another 100 loops?