Jump to content

Wait for window to load


Recommended Posts

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

Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...