sdspieg Posted December 17, 2006 Report Share Posted December 17, 2006 Is there any way to make a macro wait until a frame has loaded on a webpage? I tried with the 'wait for web'page' (without a name - because it's a java-based page and the name of the webpage itself doesn't change), also with a delay as suggested on this board, but the macro doesn't 'get' it... Here's what I try to do - I have to fill in some fields on a webform, then click on enter (and all of this works fine); but then I have to wait until that request is fulfilled until I repeat the macro, and the timing on that one is extremely erratic. Any ideas? Thanks -Stephan Quote Link to comment Share on other sites More sharing options...
paul Posted December 17, 2006 Report Share Posted December 17, 2006 One method I use is to identify a part of the web page when it's finished loading that differs from when it's not yet ready, then use the Get Pixel command within a Repeat to work out when the page is ready. Quote Link to comment Share on other sites More sharing options...
sdspieg Posted December 17, 2006 Author Report Share Posted December 17, 2006 Paul, thanks - but can you please expand on this? I'm a newbie... -Stephan Quote Link to comment Share on other sites More sharing options...
paul Posted December 19, 2006 Report Share Posted December 19, 2006 OK, let's use http://www.macros.com/ as our example. If you open this URL, you can see a small box containing the word "RSS" on the left-hand side underneath the word "Search". On my computer this box is orange, with a pixel colour of 26367 (it'll probably be different for you) and this colour is located at position 58, 562 under Active Window using the Mouse Locator tool (again, this will be different for you). But the essential point to realize (or at least hope for) is that this box is always at the same location, and always this colour (if Kevin reads this, he'll probably ask his web designer to change this immediately <g>!). So you write a script along these lines: Web Site: http://www.macros.com [Default Browser] Repeat Start (Repeat 10 times) Get Pixel: Window Coords: 58,562 into %N1% If Variable %N1% = 26367 Repeat Exit End If Wait Time Delay 1 Seconds Repeat End This opens the desired URL, then enters a loop for a maximum of 10 seconds to check the pixel colour at the specific location. When it equals our colour, then we assume the page is loaded and we exit the loop. At the end of 10 seconds, the loop terminates. If you check the value of %N1% after the loop has finished, it will equal our colour of 26367 if the page loaded successfully, and some other value if the page didn't load (or Kevin had the colour and/or location changed!). I hope this helps. Quote Link to comment Share on other sites More sharing options...
sdspieg Posted December 21, 2006 Author Report Share Posted December 21, 2006 Absolutely brilliant Paul!!! Works like a charms. Thanks so much, -Stephan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.