Restart iMacro on Error Possible?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
dombrorj
Posts: 16
Joined: Thu Jan 28, 2010 4:38 am

Restart iMacro on Error Possible?

Post by dombrorj » Thu Sep 30, 2010 9:00 pm

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?
Tom, Tech Support
Posts: 3577
Joined: Mon May 31, 2010 4:59 pm

Re: Restart iMacro on Error Possible?

Post by Tom, Tech Support » Mon Oct 04, 2010 11:33 am

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.
Regards,

Tom, iMacros Support
dombrorj
Posts: 16
Joined: Thu Jan 28, 2010 4:38 am

Re: Restart iMacro on Error Possible?

Post by dombrorj » Mon Oct 04, 2010 12:17 pm

Thanks Tom. I didn't think of that - appreciate the tip!
ChapoGuzman
Posts: 2
Joined: Sat Aug 24, 2013 2:58 am

Re: Restart iMacro on Error Possible?

Post by ChapoGuzman » Sat Aug 24, 2013 4:42 pm

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?
Post Reply