Wait...
Moderators: Dorian (MJT support), JRL
Wait...
I'm using macro scheduler and think it's great. I only have one problem. I have a macro that I use with netscape. The problem is that I at the moment use wait # when I press a link so it doesn't continue untill the link has loaded. But sometines it takes longer for the page to load and my macro continues before it should. I've looked in the help and tried WaitReady, but that doesn't work. Wait Pixel Color doesn't work either since it's the same colors at the page I'm moving to. Any hints/help out there?
Hi,
There are a number of tips to wait until a page has loaded.
WaitWindowOpen is not much help in this instance as the document title changes before the HTML is fully loaded.
You will find some examples at http://www.mjtnet.com/scripts.hts including a workaround for Netscape which uses the trick of seeing if the View/Source options is enabled or not (search for Netscape).
Internet Explorer is easier as you can use VBScript and check it's Busy property.
There are a number of tips to wait until a page has loaded.
WaitWindowOpen is not much help in this instance as the document title changes before the HTML is fully loaded.
You will find some examples at http://www.mjtnet.com/scripts.hts including a workaround for Netscape which uses the trick of seeing if the View/Source options is enabled or not (search for Netscape).
Internet Explorer is easier as you can use VBScript and check it's Busy property.
MJT Net Support
[email protected]
[email protected]
Hi,
with IE you would get a status message at the statusbar (should be the same with NS)
Loading Message = "Opening page ..."
Successfully loaded = "Done"
WaitPixelColor worked. There's a lower left (black) pixel at "Done" but not at "Opening page ..."
The animated IE Logo turns into a static one with succesfull loading (so it's with the appearance).
BTW: Script for Netscape
Ernest
with IE you would get a status message at the statusbar (should be the same with NS)
Loading Message = "Opening page ..."
Successfully loaded = "Done"
WaitPixelColor worked. There's a lower left (black) pixel at "Done" but not at "Opening page ..."
The animated IE Logo turns into a static one with succesfull loading (so it's with the appearance).
BTW: Script for Netscape
Ernest
Hi,
If you use MoveWindow followed by ResizeWindow to move and size the Netscape window, you now know the exact width, height and top left position. Using this you can now easily calculate the position of the icon as it will always be relative to these values.
If you use MoveWindow followed by ResizeWindow to move and size the Netscape window, you now know the exact width, height and top left position. Using this you can now easily calculate the position of the icon as it will always be relative to these values.
MJT Net Support
[email protected]
[email protected]
Hi,
open a DOS box in the Netscape 6 directory,
type netscp6.exe -help > n6help.txt
will give you a text file with all the command line switches for Netscape 6. The same thing works with Mozilla0.9.3.
Now you can check if there's an equivalent for the IE options F11 or the commandline switch "iexplore -k" which opens a fullscreen browser (to close with ALT+F4).
open a DOS box in the Netscape 6 directory,
type netscp6.exe -help > n6help.txt
will give you a text file with all the command line switches for Netscape 6. The same thing works with Mozilla0.9.3.
Now you can check if there's an equivalent for the IE options F11 or the commandline switch "iexplore -k" which opens a fullscreen browser (to close with ALT+F4).
Waiting for Next IE Page to Open
re: waiting for the next IE page to finish loading
I followed the link to the scripts and tips to the article titled "Another way to tell when a web page has finished loading." I've inserted what looks like a neat little tool into my program, and I've used Ernest's hint about the bottom left corner of "Done". But the scripts and tips bit of script uses four coordinates for its WaitPixelColor> and my Macro Properties dropdown menue with follow cursor on, uses three coordinates- and the position cordinates are first. Also, I'm not really sure if I've got it generally right in the two sections of my program that I marked. Any help or tips will be greatly apreciated, and thanks again for all past help. jalbt51
//This program starts from a displayed medium sized photo in photo.net,
//tabs to the "large" button, saves the photo as a bitmap image and steps back two pages
//Make sure favorites window is closed
Let>WW_TIMEOUT=30
CapsOff
SetFocus>Display photo - Microsoft Internet Explorer
Wait>0.3
//Tab to target button and activate it
//This must be a freshly opened window or the tab sequence
//might be in the middle somewhere. Number of tabs needed might vary
//if the sight changes
Tab*22
Wait>0.2
Press Enter
Wait>0.2
//the next two groups are the ones in question
//Move mouse to location of bottom left corner of "Done"
//which will appear when page has fully loaded
MouseMove>23,733
Wait>0.2
//This gotten from http://www.com.com/scripts.hts
//Titled: "Another way to tell when a web page has finished loading"
//What is the right way to write the pixel color coordinates?
Label>start
Wait>1
WaitPixelColor>23,733,0
If>WPC_RESULT=FALSE,start
//This section seems to work fine
Wait>0.2
MouseMove>9,268
Wait>0.10
LDown
MouseMove>400,268
Wait>0.20
LUp
MouseMove>100,400
GetCursorPos>100,400
Wait>0.10
Press CTRL
Send>c
Release CTRL
Wait>0.08
RClick
Wait>0.17
Press Down*6
Wait>0.17
Press Enter
Wait>0.17
Press CTRL
Send>v
Wait>0.15
Press Tab
Release CTRL
Press Down*2
Press Enter
Wait>0.06
Press Enter
Wait>0.06
MouseMove>100,400
Wait>0.15
Press ALT
Press Left
WaitReady>0
Press Left
WaitReady>0
Release ALT
Wait>0.05
Press Shift
Press Esc
Release Shift
I followed the link to the scripts and tips to the article titled "Another way to tell when a web page has finished loading." I've inserted what looks like a neat little tool into my program, and I've used Ernest's hint about the bottom left corner of "Done". But the scripts and tips bit of script uses four coordinates for its WaitPixelColor> and my Macro Properties dropdown menue with follow cursor on, uses three coordinates- and the position cordinates are first. Also, I'm not really sure if I've got it generally right in the two sections of my program that I marked. Any help or tips will be greatly apreciated, and thanks again for all past help. jalbt51
//This program starts from a displayed medium sized photo in photo.net,
//tabs to the "large" button, saves the photo as a bitmap image and steps back two pages
//Make sure favorites window is closed
Let>WW_TIMEOUT=30
CapsOff
SetFocus>Display photo - Microsoft Internet Explorer
Wait>0.3
//Tab to target button and activate it
//This must be a freshly opened window or the tab sequence
//might be in the middle somewhere. Number of tabs needed might vary
//if the sight changes
Tab*22
Wait>0.2
Press Enter
Wait>0.2
//the next two groups are the ones in question
//Move mouse to location of bottom left corner of "Done"
//which will appear when page has fully loaded
MouseMove>23,733
Wait>0.2
//This gotten from http://www.com.com/scripts.hts
//Titled: "Another way to tell when a web page has finished loading"
//What is the right way to write the pixel color coordinates?
Label>start
Wait>1
WaitPixelColor>23,733,0
If>WPC_RESULT=FALSE,start
//This section seems to work fine
Wait>0.2
MouseMove>9,268
Wait>0.10
LDown
MouseMove>400,268
Wait>0.20
LUp
MouseMove>100,400
GetCursorPos>100,400
Wait>0.10
Press CTRL
Send>c
Release CTRL
Wait>0.08
RClick
Wait>0.17
Press Down*6
Wait>0.17
Press Enter
Wait>0.17
Press CTRL
Send>v
Wait>0.15
Press Tab
Release CTRL
Press Down*2
Press Enter
Wait>0.06
Press Enter
Wait>0.06
MouseMove>100,400
Wait>0.15
Press ALT
Press Left
WaitReady>0
Press Left
WaitReady>0
Release ALT
Wait>0.05
Press Shift
Press Esc
Release Shift
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
A few suggestions after a quick observation:
1. I would suggest using WaitReady>1 right after opening MSIE.
Sample code, syntax not correct:
Run Program> MSIE
WaitWindowOpen>MSIE*
SetFocus>MSIE*
WaitReady>1
2. I would also suggest using MouseMoveRel> vs. using MouseMove
3. You are also trying to tab to a field and press enter, but your following lines are to check if page is loaded. Move checking code ahead of tabbing to make sure page is fully open and ready before tabbing.
4. You don't need SHIFT-ESC to end the macro. It will end by itself at end of macro script.
5. Some of your Wait>s look like they are from recording a macro, and can possibly be removed.
Also see recent discussions about Waiting at: http://www.mjtnet.com/forum/viewtopic.php?t=892
1. I would suggest using WaitReady>1 right after opening MSIE.
Sample code, syntax not correct:
Run Program> MSIE
WaitWindowOpen>MSIE*
SetFocus>MSIE*
WaitReady>1
2. I would also suggest using MouseMoveRel> vs. using MouseMove
3. You are also trying to tab to a field and press enter, but your following lines are to check if page is loaded. Move checking code ahead of tabbing to make sure page is fully open and ready before tabbing.
4. You don't need SHIFT-ESC to end the macro. It will end by itself at end of macro script.
5. Some of your Wait>s look like they are from recording a macro, and can possibly be removed.
Also see recent discussions about Waiting at: http://www.mjtnet.com/forum/viewtopic.php?t=892
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
1.Bob, Thanks for your reply. I don't understand #3. The tabbing is to find a button that opens the NEXT window. (is yours a script to open the first window?)
This starts in an already opened window which I find after searching around through the sight for something I like. First the medium size picture comes up, then often one has to scroll move the window to bring the "large" button into view, then the next window may take anywhere from a fraction of a second to a large fraction of a minute to come up.
2.I have to tab to the button which opens the next window, then wait for it to come up, hence the tabbing before wait.
3.I've always used absolute coordinates because It's hard to find the relative coordinates (of the exact bottom left pixel of "Done") without magnification.
To find absolute coordinates, I first press Print Scrn, then open and fully maximize a windows Paint window. Paste in the copied screen, magnify to 8x, choose the rectangular select button or pencil, then with your cursor find the pixel you want and read its coordinates from the Windows status bar. Those numbers are the absolute coordinates.
4.Does WaitPixelColor use relative coordinates?
5.Are the 3 coordinates of the Editors drop down, follow cursor, pixel color the ones to use with WaitPixelColor> ? I'd rather use WaitReady>1, but here I'm still confused about it. There's a piece about WaitPixelColor> in scripts and tips, but it uses FOUR coordinates.(see below)
6.//This gotten from http://www.com.com/scripts.hts
//Titled: "Another way to tell when a web page has finished loading"
//What is the right way to write the pixel color coordinates?
//This waits till a pixel on "Done" comes up.(see below)
Label>start
Wait>1
WaitPixelColor>12632256,768,44,5
If>WPC_RESULT=FALSE,start
7.I know everyone says eliminate the waits form a recorded macro, but I've got them down to such short values(0.10, 0.07), and every time I try to eliminate too many, the program seems to jam up in the middle.
8.Sorry for the length of this letter. Thanks so much for all the help to everyone. jalbt51
This starts in an already opened window which I find after searching around through the sight for something I like. First the medium size picture comes up, then often one has to scroll move the window to bring the "large" button into view, then the next window may take anywhere from a fraction of a second to a large fraction of a minute to come up.
2.I have to tab to the button which opens the next window, then wait for it to come up, hence the tabbing before wait.
3.I've always used absolute coordinates because It's hard to find the relative coordinates (of the exact bottom left pixel of "Done") without magnification.
To find absolute coordinates, I first press Print Scrn, then open and fully maximize a windows Paint window. Paste in the copied screen, magnify to 8x, choose the rectangular select button or pencil, then with your cursor find the pixel you want and read its coordinates from the Windows status bar. Those numbers are the absolute coordinates.
4.Does WaitPixelColor use relative coordinates?
5.Are the 3 coordinates of the Editors drop down, follow cursor, pixel color the ones to use with WaitPixelColor> ? I'd rather use WaitReady>1, but here I'm still confused about it. There's a piece about WaitPixelColor> in scripts and tips, but it uses FOUR coordinates.(see below)
6.//This gotten from http://www.com.com/scripts.hts
//Titled: "Another way to tell when a web page has finished loading"
//What is the right way to write the pixel color coordinates?
//This waits till a pixel on "Done" comes up.(see below)
Label>start
Wait>1
WaitPixelColor>12632256,768,44,5
If>WPC_RESULT=FALSE,start
7.I know everyone says eliminate the waits form a recorded macro, but I've got them down to such short values(0.10, 0.07), and every time I try to eliminate too many, the program seems to jam up in the middle.
8.Sorry for the length of this letter. Thanks so much for all the help to everyone. jalbt51
Last edited by jalbt51 on Thu Apr 15, 2004 8:58 am, edited 1 time in total.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I don't know, it's your script not mine1.(is this a script to open the first window?)
OK, I understand better now.2.I have to tab to the button which opens the next window, then wait for it to come up, hence the tabbing before wait.
To get the coordinates for anything, use the tools with Macro Scheduler. Open the Editor, click on Tools, Cursor Monitor. The Cursor Monitor uses Absolute Values for coordinates. If you maximize the window you are interested in you can get the values for Relative coordinates. Those values will then work in a reduced window with MouseMoveRel3.I've always used absolute coordinates because It's hard to find the relative coordinates (of the exact bottom left pixel of "Done") without magnification.
To find absolute coordinates, I first press Print Scrn, then open and fully maximize a windows Paint window. Paste in the copied screen, magnify to 8x, choose the rectangular select button or pencil, then with your cursor find the pixel you want and read its coordinates from the Windows status bar. Those numbers are the absolute coordinates.
No, this is using Absolute Coordinate values.4.Does WaitPixelColor use relative coordinates?
I have no idea what you are referring to. I am unfamilar with anything that uses 3 coordinates. The WaitPixelColor requires 4 values, only 2 are coordinates. Also see http://www.mjtnet.com/forum/viewtopic.php?t=892 for recent discussions about WaitReady>.5.Are the 3 coordinates of the Editors drop down, follow cursor, pixel color the ones to use with WaitPixelColor> ? I'd rather use WaitReady>1, but here I'm still confused about it. There's a piece about WaitPixelColor> in scripts and tips, but it uses FOUR coordinates.(see below)
OK, looks good to me. Is there a question here?6.//This gotten from http://www.com.com/scripts.hts
//Titled: "Another way to tell when a web page has finished loading"
//What is the right way to write the pixel color coordinates?
//This waits till a pixel on "Done" comes up.(see below)
Label>start
Wait>1
WaitPixelColor>12632256,768,44,5
If>WPC_RESULT=FALSE,start
They don't hurt, it just makes it easier to read without them. Some are needed at times, but I have found that most Wait>s in recorded macros turn out to be unnecessary. On the other hand, I never record a macro, I always write the code directly.7.I know everyone says eliminate the waits form a recorded macro, but I've got them down to such short values(0.10, 0.07), and every time I try to eliminate too many, the program seems to jam up in the middle.
Last edited by Bob Hansen on Thu Apr 15, 2004 2:28 pm, edited 2 times in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I just realized that you are using the term coordinates incorrectly. Again nothing uses 3 coordinates.
WaitPixelColor uses 4 values, only 2 are coordinates. The first value is the color code you are waiting for, the next 2 are the X,Y Absolute coordinate positions of a single pixel being monitored, and the last value is a timeout value.
GetPixelColor uses 3 values, but they are not all coordinates. The first two values are Absolute X,Y coordinates of a single pixel. The third value is not a coordinate, it is the name of the variable to store the color of the single pixel.
WaitPixelColor uses 4 values, only 2 are coordinates. The first value is the color code you are waiting for, the next 2 are the X,Y Absolute coordinate positions of a single pixel being monitored, and the last value is a timeout value.
GetPixelColor uses 3 values, but they are not all coordinates. The first two values are Absolute X,Y coordinates of a single pixel. The third value is not a coordinate, it is the name of the variable to store the color of the single pixel.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
The four WaitPixelColor values
I SEE, said the blind man!
WaitPixelColor>absolute x coordinate, absolute y coordinate, color value, timeout value
This comment, and this:
The reference to "Paint" in the WaitReady command does not refer to the "Paint" program. It refers to the OS "painting" the screen images to the monitor, or doing a refresh to a window for some reason. ( Posted: Sun Apr 11, 2004 4:28 pm)
have been sudden eye openers after groping in the fog.
Thanks, Bob and all who commented. Now I've got the bricks, it's time for the building. jalbt51
WaitPixelColor>absolute x coordinate, absolute y coordinate, color value, timeout value
This comment, and this:
The reference to "Paint" in the WaitReady command does not refer to the "Paint" program. It refers to the OS "painting" the screen images to the monitor, or doing a refresh to a window for some reason. ( Posted: Sun Apr 11, 2004 4:28 pm)
have been sudden eye openers after groping in the fog.
Thanks, Bob and all who commented. Now I've got the bricks, it's time for the building. jalbt51