Activates the specified window (makes it foremost).
WinActivate [, WinTitle, WinText, ExcludeTitle, ExcludeText]
|WinTitle||The title or partial title of the target window (the matching behavior is determined by SetTitleMatchMode). If all parameters are omitted, the Last Found Window will be activated. To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a process identifier (PID), specify ahk_pid %VarContainingPID%. To use a window group, specify ahk_group GroupName. To use a window's unique ID number, specify ahk_id %VarContainingID%. The search can be narrowed by specifying multiple criteria. For example: My File.txt ahk_class Notepad|
|WinText||If present, this parameter must be a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText is ON.|
|ExcludeTitle||Windows whose titles include this value will not be considered.|
|ExcludeText||Windows whose text include this value will not be considered.|
If the window is minimized, it is automatically restored prior to being activated.
Six attempts will be made to activate the target window over the course of 60ms. Thus, it is usually unnecessary to follow WinActivate with WinWaitActive or IfWinNotActive.
If a matching window is already active, that window will be kept active rather than activating any other matching window beneath it. In general, if more than one window matches, the topmost (most recently used) will be activated. You can activate the bottommost (least recently used) via WinActivateBottom.
When a window is activated immediately after the activation of some other window, task bar buttons might start flashing on some systems (depending on OS and settings). To prevent this, use #WinActivateForce.
Window titles and text are case sensitive. Hidden windows are not detected unless DetectHiddenWindows has been turned on.
WinActivateBottom, #WinActivateForce, SetTitleMatchMode, DetectHiddenWindows, Last Found Window, IfWinExist, IfWinActive, WinWaitActive, WinWait, WinWaitClose, WinClose, GroupActivate, WinSet
IfWinExist, Untitled - Notepad WinActivate ; use the window found above else WinActivate, Calculator
Homepage | Command List