Jump to content
Macro Express Forums

Wait For Web Page To Load


Markter

Recommended Posts

This should work.

Repeat Until %N1% <> %N1%
 Web Site: http://www.pgmacros.com [Default Browser]
 Wait for Web Page: ""
 Repeat Start (Repeat 60 times)
   Variable Set String %T1% from Window Title
   If Variable %T1% contains "Macro Libraries"
     Repeat Exit
   End If
   Delay 250 Milliseconds
 Repeat End
 If Variable %N1% = 60
   AND
 If Message: "Web Page Error"
 Else
   Repeat Exit
 End If
Repeat End

<REP3:08:000002:000002:0001:1:01:N1><HTTP2:1:F:http://www.pgmacros.com><WAITWEB2:000000:000000:><REP3:01:000001:000001:00060:1:01:><TVAR2:01:06:><IFVAR2:1:01:7:TMacro Libraries><EXITREP><ENDIF><IMSD:250><ENDREP><IFVAR2:2:01:1:60><AND><IFMESS3:00000:1:1:Web Page Error
   Could not load the web page. would you like to try again?Center:Center><ELSE><EXITREP><ENDIF><ENDREP>

It is designed to avoid waiting for a particular page to load. Instead the Wait for Web Page command waits indefinitely for any page to load.

 

If the browser launches at all then some web page should load, even if it is one of those "This page cannot be found" error pages. The Repeat Start (Repeat 60 times) loop is used to test for a particular window title to have focus, which is the title of your target web page. Since it delays 1/4 of a second between loops, it will wait 15 seconds and then exit. If the loop counter is 60 then you are prompted to try again.

 

This is only meant as an example. There are plenty of variations that can be made to this macro to suit your individual needs.

Link to comment
Share on other sites

Thanks Joe,

I had a situation on Saturday where my Macro aborted because a web page did not load, the system lost connectivity. It made me go back and look at the code and determine I did not need a Internet page to load but rather a Intranet page.

I was loading an Internet to load the Intranet....DOH! :o

Robert

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...
×
×
  • Create New...