AutoIt WinWait Function

Function to pause the execution of the script until a specified window exists.

3082 views

Edited: 2021-02-14 01:53

The WinWait function can be used to make the script pause, until a specified window opens. Useful if the execution of your script depends on a specific program running.

The check is performed around every 250 milliseconds.

The following script will wait for 20 seconds, to see if notepad opens, and close it if it dose, but exit if it doesn't.

Run("notepad.exe")

WinWait("[CLASS:Notepad]", "", 10)
sleep(5000)
WinClose("[CLASS:Notepad]")

Parameters

titleTitle, hWnd or class of the window to check.
textOptional. Text to check for.
timeoutOptional. The timeout is in seconds.

Tell us what you think:

  1. How to declare and work with variables in AutoIt, as well as some background information.
  2. Everything you need to know about working with minimized windows.
  3. How to set the request headers when performing HTTP requests.
  4. This Tutorial will focus on post requests in AutoIt, using the Winhttprequest.5.1 object.
  5. How to use while, for, and do until loops, and how to loop through arrays and object in AutoIt.

More in: AutoIt Tutorials