Avoiding javascript dialogue box on error?

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
viking
Posts: 243
Joined: Sun Mar 16, 2008 7:22 am

Avoiding javascript dialogue box on error?

Post by viking » Mon Nov 16, 2009 8:03 pm

I am trying to go back to previous page when there is an error (an image is not found):

Code: Select all

iimPlay ("CODE: SET !ERRORIGNORE YES");
retcode = iimPlay("CODE: TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:dlf ATTR=SRC:http://someSite.com/img/someImage.jpg");
    if (retcode < 0) {              // an error has occured
        errtext = iimGetLastError();
        alert(errtext);
        iimPlay("CODE:BACK");
    }
With the code above I still get an error dialogue box where I have to click "OK" before the page goes back. How can I avoid the dialogue box?
josephconlin
Posts: 190
Joined: Wed Aug 06, 2008 2:38 am

Re: Avoiding javascript dialogue box on error?

Post by josephconlin » Mon Nov 16, 2009 10:40 pm

viking wrote:I am trying to go back to previous page when there is an error (an image is not found):

Code: Select all

iimPlay ("CODE: SET !ERRORIGNORE YES");
retcode = iimPlay("CODE: TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:dlf ATTR=SRC:http://someSite.com/img/someImage.jpg");
    if (retcode < 0) {              // an error has occured
        errtext = iimGetLastError();
        alert(errtext);
        iimPlay("CODE:BACK");
    }
With the code above I still get an error dialogue box where I have to click "OK" before the page goes back. How can I avoid the dialogue box?

Code: Select all

iimPlay ("CODE: SET !ERRORIGNORE YES");
retcode = iimPlay("CODE: TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:dlf ATTR=SRC:http://someSite.com/img/someImage.jpg");
    if (retcode < 0) {              // an error has occured
        errtext = iimGetLastError();
        //alert(errtext);
        iimPlay("CODE:BACK");
    }
Your code says "If there is an error (which I know because retcode is less than zero), then store the error message in errtext, then show a dialog box (alert is a Javascript command that shows a dialog box with whatever text you specify) so I can see the error message, then play the iMacros command BACK. In the code that I edited, the only change was to comment out the part that displays the error message (the alert command). It shouldn't happen now.

Hope this helps.
viking
Posts: 243
Joined: Sun Mar 16, 2008 7:22 am

Re: Avoiding javascript dialogue box on error?

Post by viking » Mon Nov 16, 2009 11:10 pm

josephconlin wrote:
viking wrote:I am trying to go back to previous page when there is an error (an image is not found):

Your code says "If there is an error (which I know because retcode is less than zero), then store the error message in errtext, then show a dialog box (alert is a Javascript command that shows a dialog box with whatever text you specify) so I can see the error message, then play the iMacros command BACK. In the code that I edited, the only change was to comment out the part that displays the error message (the alert command). It shouldn't happen now.

Hope this helps.
Yes, it did. Thanks!

I though that the error would just show w/o an OK box that I had to click. In fact, there is also another error message shown, and I though that this was the one from the JavaScript. However, I now realize now that this error is thrown by the macro code:
"CODE: TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:dlf ATTR=SRC:http://someSite.com/img/someImage.jpg"
rather than iimPlay.

BTW, is there some way of hiding this iimPlay error message?
Hannes, Tech Support

Re: Avoiding javascript dialogue box on error?

Post by Hannes, Tech Support » Tue Nov 17, 2009 9:05 am

BTW, is there some way of hiding this iimPlay error message?
Starting with version 6.3 (http://forum.imacros.net/viewtopic.php?f=11&t=8208), the error messages are shown at the bottom of the iMacros tab. So it's no longer covering the currently played macro or the list of macros.
Post Reply