I have written a script that is supposed to open up pages, then print them. I had set it up to run a sleep delay to allow the new page to pop up. However, the pages are not loading in a predictable time.
As the pages are loading, there is a message at the bottom of the window that the page is Loading. Once it is loaded, the message is Ready.
I tried finding the info on the window with the HiddenText and window spy, but I could not find a difference between the Loading and Ready versions.
Any ideas where or how else I could look for the difference between the two pages?
Thank you
3 Answers
The easy way is to make a small screenshot of the loading message and the use the ImageSearch command (see here) to search for it. Do this in a loop combined with a sleep delay of a second. If the loading message doesn't appear right away, do a reasonable sleep before you check for the first time.
An alternate way is to learn how to remote control the internet explorer with the com model (see here) where in most cases this problem doesn't exist as you can wait until a page has fully loaded.
I ended up using a pixel search for an icon. If the icon had a specific color, it would move forward. If it did not, it would stop.
I created a script that would look at a page with both icons, then see if a color/shade range existed in one icon, then check if it showed up in the second icon. It shows the regions it is searching, and cycles so you can check multiple color/shade ranges to find one that works.
settitlematchmode, 2
settitlematchmode,slow
detecthiddentext,on
page_count :=1
msgbox,start
sleep,3000
loop
{
msgbox,%color%,%shades%
inputbox,color,,color,,400,150,100,50,,60000,
inputbox,shades,,number of shades,,400,150,100,50,,60000,
winactivate,Ventyx
sleep,500
mousemove 293,53
sleep,1000
mousemove 312,73
sleep,1000
pixelsearch,,,293,53,312,73,%color%,%shades%
{
if errorlevel=1
{
msgbox, no white in next page
}
else
msgbox,white found in next page
}
winactivate,Ventyx
sleep,500
mousemove 271,53
sleep,1000
mousemove 290,73
sleep,1000
pixelsearch,,,271,53,290,73,%color%,%shades%
{
if errorlevel=1
{
msgbox,no white found in prev page
}
else
msgbox,white found in prev page
}
}
msgbox,end