The Close Window action is used to close an open window. If the specified window is the main window for the application, the application is closed. You can choose to request the close, which allows the program to prepare for closing, or you can force the close, which closes abruptly and can result in loss of data. An application that does not have a main window can be closed using the End Process action.
You can define the window as specifically or as generally as you like. If more than one window matches the properties entered, all matching windows are acted on. By default only visible windows are affected, but the action can be set to include hidden windows.
You can also populate variables or a dataset with the properties of the window. Any variables used must be created in earlier steps using the Create Variable action. If more than one window was acted on, only the first is reported.
From the Task Builder Available Actions pane, open the Window folder and double-click the Close Window action or drag it into the Steps pane.
If possible, open the window that you want the step to close. Then drag the AutoMate icon into the window. This will automatically populate the window properties. If you cannot open the window, use a similar window and then edit the properties per step 4 below.
Select or clear the check boxes to indicate which window properties are required.
If you need to make changes to the auto-populated properties, use the following guidelines:
Window title must be: the window title as shown in the title bar. You can use wildcard characters asterisk (*) or question mark (?). For example *report* can be used to specify any name containing the word report.
Window class must be: the class of window, such as Microsoft Word (OpusApp), or Adobe Acrobat (AdobeAcrobat). The drop-down list shows the classes of all currently open windows. You can use wildcard characters asterisk (*) or question mark (?).
Window handle must be: a unique value that Windows assigns each time a window is created. You might use this for situations where there may be more than one copy of the same application open. (This must be auto-populated.)
Under Close type, select Request to allow the application to prepare for closing and offer the opportunity to save changes, or select Force to shut the window abruptly, possibly losing data.
To specify one or more objects to be used in identifying the window, click the Contents tab, select Window must contain the objects, and then enter the properties for each object as follows:
The Select an Object dialog box opens.
Drag the AutoMate icon to the object.
If you need to edit the auto-populated properties, click Edit. Then in the Define a Control dialog box, edit the properties according to the following guidelines:
Select or clear the check boxes to indicate which properties are required.
The Class, Name, or Value properties can accept wildcard characters.
To use a variable or expression, click within any box and then click the Insert Expression/Variable button and use the Expression Builder to enter it.
The properties are as follows:
Object type must be: the type of object, such as title bar, drop-down list, or toolbar.
Object class must be: the Windows class of the object.
Object name must be: the name of the object.
Object value must be: the value populating the object, such as a selection in a drop-down list.
Object position must be: the coordinates for the position of the object on the screen.
OK in each dialog box to return
to the Contents page.
The entered object is listed.
If you need to delete an object, select it on the list and click Delete.
To designate variables or a dataset to be populated with the window properties, click the Advanced tab and enter the properties as follows:
If the window you want to close will be hidden when the step runs, select Include hidden windows.
For each property that you want to place in a variable, select the check box and then select the variable in the box below.
To place the window title, class, and handle in a dataset, select Create and populate dataset, and then enter a name for the dataset in the box below.
To set the Description tab properties, refer to Description Tab Options.
To set the Error Causes and On Error tab properties, refer to Step Error Handling.
When finished, click OK to save settings and close the properties dialog window.
Adding Task Steps
Window Dissection Parameters
Close Window Action