Jump to content
Macro Express Forums

How to ignore errors so macro does not abort


ejs
 Share

Recommended Posts

How can I set up a macro so that if it encounters an error in the middle of the script, the macro will continue at the next command in the script rather than aborting? I've tried using the "log errors" command, but that only suppresses of the error message dialog box; the macro still aborts.

 

Specifically, I want to use the 'wait for web page to load' command, and I have the maximum wait time set to 10 seconds. If the web page does not load in ten seconds, the wait for web page command aborts the macro. But I really want the macro to continue at the next command in the script after ten seconds regardless of whether the web page has completed loading or not. I can't simply replace the wait for web page command with a 10 second delay command, because then the user will always be waiting a full 10 seconds every time, even though the web page normally loads in one second.

 

Also, I would like to applied this "ignore error and continue" behavior only to specific macros. I don't want to select a systemwide option that would make this happen to all my macros.

Link to comment
Share on other sites

As far as I know there is no way. In the future this will change but for now we have to deal with it. How I approach the problem is to instead of letting the timeout happen I will do a 10X repeat with a 1 second delay. In that repeat I will test the top window to see if it meets my criteria. This way I can in effect get the error handling I want.

Link to comment
Share on other sites

An idea I had and have played with a little is to make my own error handling. I create ‘markers’ where I write something to the registry like “waitfor23” for my twenty-third wait command right before it starts waiting. Then when it’s done waiting wipe out the registry value. At the beginning of the macro I can enable another macro like “error handler” which is set to run on a schedule. At the end of the macro I disable the error handler macro. So if nothing errors all if fine. But if it does error out and the user cancels the macro then the error handler macro is still enabled and will run. It will use that registry value to somehow jump back to that point in the macro or do something else. Crude, but it works.

Link to comment
Share on other sites

  • 8 months later...

Cory,

That's very interesting and creative. But can you help with the mechanics? How to put a marker etc. I am not aware of a command that will enable jumping to a specific marker inside a macro. I suppose all variables must be backed up to the registry or environment variables?

 

Do you have an example you can send.

 

 

 

An idea I had and have played with a little is to make my own error handling. I create ‘markers’ where I write something to the registry like “waitfor23” for my twenty-third wait command right before it starts waiting. Then when it’s done waiting wipe out the registry value. At the beginning of the macro I can enable another macro like “error handler” which is set to run on a schedule. At the end of the macro I disable the error handler macro. So if nothing errors all if fine. But if it does error out and the user cancels the macro then the error handler macro is still enabled and will run. It will use that registry value to somehow jump back to that point in the macro or do something else. Crude, but it works.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...