# Function Reference

# WinWaitActive

Pauses execution of the script until the requested window is active.

WinWaitActive ( "title" [, "text" [, timeout = 0]] )

## Parameters

title | The title/hWnd/class of the window to check. See Title special definition.
text | [optional] The text of the window to check. Default is an empty string. See Text special definition.
timeout | [optional] Timeout in seconds if the window is not active. Default is 0 (no timeout).

## Return Value

Success: | a handle to the requested window.
Failure: | 0 if timeout occurred.

## Remarks

The window is polled every 250 milliseconds or so.

## Related

ProcessWait, WinActive, WinExists, WinWait, WinWaitClose, WinWaitDelay (Option), WinWaitNotActive

## Example

    Example()

    Func Example()
        ; Run Notepad
        Run("notepad.exe")

        ; Wait 10 seconds for the Notepad window to appear.
        WinWaitActive("[CLASS:Notepad]", "", 10)

        ; Wait for 2 seconds to display the Notepad window.
        Sleep(2000)

        ; Close the Notepad window using the classname of Notepad.
        WinClose("[CLASS:Notepad]")
    EndFunc   ;==>Example