Purpose:Activate a window, set its state, or change its title

 

Format:ACTIVATE [/=] [/R] "title" [MAX | MIN | RESTORE | DESKTOP | CLOSE | ENABLE | DISABLE | TOPMOST | NOTOPMOST | TOP | BOTTOM | HIDE | FORCEMIN | VDESKTOP=id | /FLASH=type,count | /ICON=iconfile | /POS=left,top,width,height | /TRANS=n | TRAY | "newtitle"]

 

/=Call the ACTIVATE command dialog
titleCurrent title of the window to be activated
leftNew location of the left border of the window, in pixels
typeOne or more of the following values:

0 - stop flashing

1 - flash the window caption

2 - flash the taskbar button

4 - flash continuously until WINDOW is called again with the /FLASH type set to 0

12 - flash continuously until the window comes to the foreground (cannot be used with 4)

countNumber of times to flash the window
topNew location of the top border of the window, in pixels
iconfileNew caption / task bar icon (an .ico file or an executable)
widthNew width of the window, in pixels        
heightNew height of the window, in pixels
newtitleNew title for window

 

/R(estore original window)

 

See also: START, TITLE, and WINDOW.

 

Usage:

 

ACTIVATE activates, and optionally modifies, another session's window. It is not intended to modify the characteristics of the current TCC session (use TITLE or WINDOW for that purpose).

 

Title specifies the name of the target window to be activated. You can use wildcards, including extended wildcards, in title. This is useful with applications that change their window title to reflect the file currently in use. Title must be enclosed in quotes.

 

If title begins with a =, it is assumed to be a process ID instead of a title. (Note that this is less reliable than providing a title, as a process can have multiple top-level windows.)

 

Each execution of ACTIVATE allows you to modify one property of the target window. To perform multiple operations, use multiple ACTIVATE commands.

 

The options are:

 

MAX

Expands the window to its maximum size and activates it.

MIN

Reduces the window to an icon.

RESTORE

Activates the window at its default size and location.

DESKTOP

Activates the Windows desktop.

CLOSE

Sends a "close" message to close the window.

ENABLE

Enable mouse and keyboard input.

DISABLE

Disable mouse and keyboard input.

TOPMOST

Keeps the window on top of all other windows until it closes, or NOTOPMOST is used.

NOTOPMOST

Allows other windows to overlay the window (this is the normal state for most windows).

TOP

Moves the window to the top of the window order, above all other non-TOPMOST windows.

BOTTOM

Moves the window to the bottom of the  window order.

HIDE

Makes the window invisible (to make the window visible again, use RESTORE).

FLASH

Flash the window.

ICON

Change the window's caption and task bar icon.

POS

Sets the window position and size (in pixels).

TRANS

Transparency level, where n=0 (invisible) to 255 (opaque) (does not work for console windows).

TRAY

Move the specified window to the system tray.

VDESKTOP

Move the window to another virtual desktop. id can be either a desktop number (1-n), the GUID for that desktop, or the desktop name. See VDESKTOP for more details.

FORCEMIN

Force the window to be minimized even if the thread that owns the window is not responding.

"newtitle"

Changes the window title.

 

Numeric input may be entered in either decimal format (a sequence of 0-9 digits) or in hexadecimal format ("0x" followed by a sequence of 0-F hex digits).

 

If you specify newtitle, it must be enclosed in double quotes (which will not appear as part of the title text).

 

ACTIVATE is often used before KEYSTACK to make sure the proper window receives the keystrokes.

 

ACTIVATE works by sending messages to the named window. If the window ignores or misinterprets the messages, ACTIVATE may not have the effect you want.

 

If ACTIVATE is used in a batch file, and the batch file is not itself running in the active window (the window with its title bar highlighted), then ACTIVATE may not activate the desired window. This is because under Windows you cannot make another window active except when the window which issues the command is itself active already. This is a Windows feature which helps to prevent windows which are not in the foreground from grabbing input intended for other windows.

 

/POS - accepts a * value for any of the arguments. If the value is *, ACTIVATE will use the existing position / width / height value. For example, to resize a window without moving it:

 

ACTIVATE "title" /POS=*,*,1200,800

 

To move a window without resizing it:

 

ACTIVATE "title" /POS=200,400,*,*

 

Examples:

 

The examples below first maximizes, and then renames the window originally called "Take Command":

 

activate "Take Command" max

activate "Take Command" "Take Command is Great!"