Variable Set Handle


This command is a reliable way to uniquely identify windows by their titles. Even if the window title later changes, this command still identifies the window - as long as the window has not closed.


In the operating system each window receives a handle for unique identification purposes. Use this variable later in other Window commands such as Resize, Reposition, etc.



Script Editor > Expand Variables Category > Variable Set Handle



Method to Set Handle(s)

Enumerate Windows with a Specific Title

Enumerate Windows with a Specific Title saves any windows that would include for example Microsoft, Macro Express, Word, etc. in the title. Create a variable array to save the Windows to individual variables.


Window with a Specific Title

Window with a Specific Title saves the name of a single window to a handle variable. If more than one running window contains the same Title, the first window found by Macro Express is saved to the variable.


Get from a Control

First define a Control variable using the Get Control or Capture Control commands. Insert the name of the control variable in this field.




Insert the window title or control name in the title field. Or click on the Browse button to select a currently running window.


Exact Match

This requires that the window name entered matches exactly with the name of the window waiting to receive focus. For example, if listing Notepad as the window name, but the actual window title is Notepad - Untitled, then the macro would not wait.


Partial Match

The Partial Match option does not require an exact window title match. For example, if waiting for a notepad window, inserting "notepad" or "notep" as the window title will find the window. This is particularly useful as some Window Titles change based on whether a given file is open. Case sensitivity is not required. For example, "NOTepad" will work as well as "notepad".


The Name contains Wildcards

Select this option if a wildcard is included in the window title name. A wildcard uses the " * " or " ? " characters in the title to expand the possibilities of a match. These are similar to the wildcards used in Windows for searches.


Note: The Exact/Partial Match and Wildcards are only available with the window options. They are disabled when setting the handle of a control.




Insert the variable name to receive the handle information. Or click on the Variable button to select the Handle variable previously defined.