Jump to content
Macro Express Forums

"Wait for Web Page" fails and crashes my script

Jonny Quick

Recommended Posts

Frankly my underwear are wadded-up on this one. I'm using the script to launch proxied web-pages. The proxies are unreliable and sometimes they fail to load quickly (hence the "wait for"), and sometimes they don't load at all.


When the page fails to load, the whole script goes down and that is completely unacceptable. There are other commands that give you the option to "continue" on error, and if I could do that, I could work around the issue. I have version (licensed).


I'm considering getting the Pro version, and from what I've read this problem is dealt with there, I just want to make certain I have to go to Pro in order to get away from this issue.


Also, can I upgrade my ME license, or do I have to buy the whole license at full price ?


Certain other features make Pro very attractive to me, and I'll be getting that eventually, but right now I want to get this script to stop failing if possible. Any help appreciated & thanks in advance.



Link to comment
Share on other sites

If you use the Log Errors command, errors are logged and the macro continues. You may want to have the macro get information from the file containing the log to determine that it failed and what happened. The macro could then proceed accordingly.


In Macro Express Pro you can set the action to perform when an error occurs for each macro command allowing the macro to handle different types of errors. If you own a Macro Express 3 license you may purchase Macro Express Pro at a discount. Read our Upgrade Policy for details.

Link to comment
Share on other sites

In version 3, if the page is not found the macro halts. Macro Express Pro includes error handling to take care of these situations.


You may be able to use the Get Pixel Color command to do what you need in Macro Express 3. You will need to determine a fixed position on the screen that changes colors after the page has loaded.


Here's a sample of how this portion of the macro would look.


Variable Set Integer %N1% to 0

Variable Set Integer %N3% to 0

Repeat Until %N1% = 1

Get Pixel: Screen Coords: 100,100 into %N2%

Wait Time Delay 1 Seconds

If Variable %N2% = 186023

**** steps you would take after the web page is opened.

Variable Set Integer %N1% to 1

End If

Variable Modify Integer: Inc (%N3%)

If Variable %N3% = 60

Repeat Exit

End If

Repeat End


Use the Mouse Locator in the Get Pixel command to find the coordinates and the color value of the pixel to check. Use the If Variable command to see if the color value matches. If it does, then the macro performs the steps it is supposed to take on the web page and then exits out of the Repeat loop because N1 is set to 1. If it doesn't, then the macro repeats the loop again, looking for the change.


As in the example above, you might want to add a Wait Time Delay to check every so many seconds, rather than constantly checking. Use the Wait Time Delay rather than a standard Delay. This will free up CPU cycles during the wait time.


The macro has a 2nd If statement. It is incrementing the value of N3 each time through the repeat loop. Since the example has a 1 second delay, the macro would exit out of the loop approximately 60 seconds after trying to find the web page.

Link to comment
Share on other sites

  • 4 weeks later...

Perhaps, you could also:

1) just prior to attempting new page load, move mouse to an area that would cause a change in the mouse cursor upon the new page successfully loading.

2) have macro look for failed page load titles; upon recognizing a failed page load -> a) refresh page, or (B) go back to initial page and retry new page load

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.

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.

  • Create New...