<< Click to Display Table of Contents >>

Navigation:  TCC > Commands >


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 | /FLASH=type,count | /ICON=iconfile | /POS=left,top,width,height | /TRANS=n | TRAY | "newtitle"]


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.




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:



Expands the window to its maximum size and activates it.


Reduces the window to an icon.


Activates the window at its default size and location.


Activates the Windows desktop.


Sends a "close" message to close the window.


Enable mouse and keyboard input.


Disable mouse and keyboard input.


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


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


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


Moves the window to the bottom of the  window order.


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


Flash the window.


Change the window's caption and task bar icon.


Sets the window position and size (in pixels).


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


Move the specified window to the system tray.


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.




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!"