How do I suspend macro until web page completely loads?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Max
Newbie
Posts: 3
Joined: Wed Sep 27, 2006 10:27 pm

How do I suspend macro until web page completely loads?

Post by Max » Wed Sep 27, 2006 10:37 pm

I want to open an arbitrary web page from a link and have the macro suspended until the new web page completely finishes loading up.

I just cant seem to figure it out. It shoudl be something so simple. like a simple waitready> command that just suspends the script until the window completely loads.

Im doing this because i don't want to use a timeout. I want my macro to run as fast as possible and since the loading time of web pages varies, then i would be waisting time if i used a long timeout while crashing the macro with too low of a timeout.

Thank you.
Max.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Sep 28, 2006 12:20 am

The only good way is to use IE's own busy function. Details in this thread

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Sep 28, 2006 3:48 am

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Max
Newbie
Posts: 3
Joined: Wed Sep 27, 2006 10:27 pm

And Firefox?

Post by Max » Thu Sep 28, 2006 2:06 pm

A couple of things. First, is there anything that can be done with firefox to force it to wait until the pressed link, not a newly launched firefox window, fully loads the page. (if way too complicated, then never mind)

And two, this process of waiting for a link to fully loadup and setting a timeout seems to be a common routine. Are you guys going to be implementing a simple approach to this problem in future revisions of your Macro Scheduler?

Wouldn't it be sweet if it can be as simple as this:

waitloadcomplete>url,result
timeout>5 sec

if>result=1(page loaded)
then...
else
endif

Thank you.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Sep 28, 2006 3:02 pm

Hi,

FireFox doesn't provide the same kind of interface as IE, so, no, there's no alternative for FF. For web site automation it is best to use IE.

To automate IE either use the VBscript samples linked above, or the WebRecorder IEAuto library.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Sep 28, 2006 4:14 pm

There is a way to do this if you have control of the computer that's waiting for Firefox. The technique mentioned here could be employed.

Basically, if the Firefox Navigation Toolbar is turned on there is an icon that is a stop sign with a white "X" in it. Mine is located 145 pixels to the right of the upper left corner of the Firefox window and 65 pixels down from the same corner. While the web page is loading that icon is red, (color 3573) when the web page has finished loading, the color changes to grey (color 11711927)

Simply check the pixel color of that icon location after you start your download. When the pixel color is grey, the download is complete.

Hope this helps,
Dick

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Sep 28, 2006 4:19 pm

I have an old script somewhere that I used to do that for Netscape. Don't have access right now, but I seem to recall that I looped on one of the Main Menu options that would not be available until the page was fully loaded. Once the menu option worked I would know the page was loaded and jump out of the loop.

I suspect the same method would work for Firefox. Perhaps someone else will know which Main Menu options are not available until fully loaded.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Sep 28, 2006 4:19 pm

Good idea - or use the image recognition library to wait while the stop button is present.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Max
Newbie
Posts: 3
Joined: Wed Sep 27, 2006 10:27 pm

Post by Max » Thu Sep 28, 2006 6:20 pm

There's always a way isn't there.

It just takes overservation and creativity.

I was looking for a cue or something that would reveal if the page has completed loading. But i just couldn't find it.

Thanks a bunch guys.

Max

PS>Im using a trial version of your latest version of Macro Scheduler, and i would like to tell you (the administrator) that it would be handy if all lines of codes were had letters automatically capitalized.

Another words: if i type press c, it would be nice if Macro Scheduler automatically changed it to Press c.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts