Jump to content

AutoIt Command to wait for a window to load?


Recommended Posts

I'm running a script to automate certain tasks on my computer. It's uses Windows Explorer, so I'm using

WinWait("") 
and
ControlSend("", "", 0, "However many tabs and enter...")

to navagate. Here's the problem. When the window appears, the script continues regardless if the window has fully loaded or not. This is not good for slow computers because the tabs wont work until the window is loaded and responding. How can I get around this? I'm using Windows Vista and trying to navigate through Control Panel Applets. For Example "Manage Network Connections" in the Network Connections and Sharing Center.

Link to comment
Share on other sites

Have you tried something along the lines of...

If Not WinExists("Some Window") Then WinWait("Some Window")
. I usually play around with the different functions till I find a combination that works. Sometimes you can even add a Sleep() call in there to assist it in waiting. You could also use...WinWaitActive(), or WinWaitNotActive().

I hope this helps some,

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I did put a sleep in there. but I want this script to run as fast as possible and the sleep times aren't the same for different computer speeds.

And the window exists before it loads so the WinWait() command is limited in this situation...

Link to comment
Share on other sites

find the control that appears last when its open

then do a

while ControlGetHandle("the window name", "", "control") = ""

sleep(100)

wend

then do you stuff here

Edited by billthecreator

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Link to comment
Share on other sites

find the control that appears last when its open

then do a

while ControlGetHandle("the window name", "", "control") = ""

sleep(100)

wend

then do you stuff here

OOH! Interesting. Thanks. I'll try it.

EDIT: I ended up using ControlCommand() and the IsVisible option to sleep until it returned true.

Edited by Damastah
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...