Activates (gives focus to) a window.
WinActivate ( "title" [, "text"] )
|title||The title/hWnd/class of the window to activate. See Title special definition.|
|text||[optional] The text of the window to activate. Default is an empty string. See Text special definition.|
|Success:||the handle of the window.|
|Failure:||0 if window is not found or cannot be activated.|
You can use the WinActive() function to check if WinActivate() succeeded. If multiple windows match the criteria, the window that was most recently active is the one activated. WinActivate() works on minimized windows. However, a window that is "Always On Top" could still cover up a window you Activated.
After a successful activation @extended is set to 1 if the the window was already active, 2 if not.
WinClose, WinKill, WinMove, WinSetState, WinTitleMatchMode (Option)
Example() Func Example() ; Run Notepad Run("notepad.exe") ; Wait 10 seconds for the Notepad window to appear. Local $hWnd = WinWait("[CLASS:Notepad]", "", 10) ; Activate the Notepad window using the handle returned by WinWait. WinActivate($hWnd) ; Close the Notepad window using the handle returned by WinWait. WinClose($hWnd) EndFunc ;==>Example