Sign in to follow this  
Followers 0
NeedSomeHelp1

Wait for window to load

5 posts in this topic

Hi - I'm trying to run a script that opens print preview and then sets the page to landscape by sending Alt+L. The problem that I am having is that it trys to send this command before the page has finished loading and it obviously doesn't work. It will work with a sleep command, but I am trying to avoid using sleep to avoid other issues. Is there some other function besides winwait to wait for the window to fully load? My script looks like this:

$oIE.execWB(7,1)

WinWait("Print Preview")

;Sleep(1000)

ControlSend("Print Preview", "","","{ALT}+{L}")

Thanks

Share this post


Link to post
Share on other sites



Have you already tried using the timeout argument in WinWait?


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Wouldn't that be the same thing as using sleep? I just trying to avoid relying on the computer to work at a certain speed, and would like the scipt to run fast instead of waiting for unecessary time as a precaution to make sure everything is loaded.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

WinWait() waits for the window to exist,

it does not know how to wait for the program to load.

try using ControlCommand() with the "IsVisible" command to see if the button you want exist.

And next time you post your code with

[/autoit], like this:
[autoit]Msgbox(0,'','Hi')
Edited by MiserableLife

Share this post


Link to post
Share on other sites

I tried using ControlCommand but theres a problem. The landscape button isn't able to be specifically seen. I tried using the window info tool/ finder tool on it and there is no different on the landscape button than the rest of the window.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0