Window - List windows
Declaration
<AMWINDOW ACTIVITY="information" ALLOWHIDDEN="YES/NO" RESULTDATASET="text" />
Description
Retrieves a list of all open windows and populates a dataset with the results. Hidden windows can be retrieved as well.
Practical usage
Commonly used along with the Loop dataset activity as a method to manage the windows that are open on the desktop.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Create and populate dataset | Text | Yes | (Empty) | RESULTDATASET="windowData" | The name of the dataset to create and populate with the list of open windows. More details about the dataset that this activity creates can be found below under Datasets. |
Include hidden windows | Yes/No | No | Yes | ALLOWHIDDEN="YES" | If selected, hidden windows will be included in the list. Disabled by default. |
Additional notes
Datasets
A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).
Name | Type | Return Value |
---|---|---|
theDataset.Title | Text | Returns the window title of the current window on the list. |
theDataset.Class | Text | Returns the class of the current window on the list. |
theDataset.Handle | Number | Returns the handle of the current window on the list. |
theDataset.ProcessName | Text | Returns the process name of the current window on the list. |
theDataset.ProcessID | Number | Returns the process ID of the current window on the list. |
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This sample task saves all open windows onto a dataset. A Loop dataset activity is then used to display information about each open window.
<AMWINDOW ACTIVITY="information" ALLOWHIDDEN="YES" RESULTDATASET="theDataset" />
<AMLOOP ACTIVITY="dataset" DATASET="theDataset"><AMSHOWDIALOG WINDOWTITLE="Current Window">Window title - %theDataset.Title%
Window class - %theDataset.Class%
Window handle - %theDataset.Handle%
Window process name - %theDataset.ProcessName%
Window process ID - %theDataset.ProcessId%</AMSHOWDIALOG></AMLOOP>
<AMSHOWDIALOG WINDOWTITLE="Current Window">Window title - %theDataset.Title%Window class - %theDataset.Class%Window handle - %theDataset.Handle%Window process name - %theDataset.ProcessName%Window process ID - %theDataset.ProcessId%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />