WinMinimize

Collapses the specified window into a button on the task bar.

WinMinimize , WinTitle, WinText, ExcludeTitle, ExcludeText

Parameters

WinTitle, WinText, ExcludeTitle, ExcludeText

If each of these is blank or omitted, the Last Found Window will be used. Otherwise, specify for WinTitle a window title or other criteria to identify the target window and/or for WinText a substring from a single text element of the target window (as revealed by the included Window Spy utility).

ExcludeTitle and ExcludeText can be used to exclude one or more windows by their title or text. Their specification is similar to WinTitle and WinText, except that ExcludeTitle does not recognize any criteria other than the window title.

Window titles and text are case-sensitive. By default, hidden windows are not detected and hidden text elements are detected, unless changed with DetectHiddenWindows and DetectHiddenText. By default, a window title must start with the specified WinTitle or ExcludeTitle to be a match, unless changed with SetTitleMatchMode.

Remarks

Use WinRestore to unminimize a window or WinMaximize to maximize it.

WinMinimize minimizes the window using a direct method, bypassing the window message which is usually sent when the minimize button, window menu or taskbar is used to minimize the window. This prevents the window from overriding the action (such as to "minimize" to the taskbar by hiding the window), but may also prevent the window from responding correctly, such as to save the current focus for when the window is restored. It also prevents the "minimize" system sound from being played.

If a particular type of window does not respond correctly to WinMinimize, try using the following instead:

PostMessage, 0x0112, 0xF020,,, WinTitle, WinText ; 0x0112 = WM_SYSCOMMAND, 0xF020 = SC_MINIMIZE

This command operates only upon the topmost matching window except when WinTitle is ahk_group GroupName, in which case all windows in the group are affected.

WinRestore, WinMaximize, WinMinimizeAll

Examples

Opens Notepad, waits until it exists and minimizes it.

Run, notepad.exe
WinWait, Untitled - Notepad
WinMinimize ; Use the window found by WinWait.

Press a hotkey to minimize the active window.

^Down::WinMinimize, A  ; Ctrl+Down