Get Selected Tree Item Action

Declaration

<AMGETSELECTEDTREEITEM WINDOWTITLE="text" WINDOWCLASS="text" WINDOWHANDLE="number" OBJECTNAME="text" OBJECTVALUE="text" OBJECTCLASS="text" OBJECTTYPE="text" CHECKOBJECTNAME="yes/no" CHECKOBJECTVALUE="yes/no" CHECKOBJECTCLASS="yes/no" CHECKOBJECTTYPE="yes/no" CHECKOBJECTPOSITION="yes/no" OBJECTXPOS="number" OBJECTYPOS="number" RESULTVARIABLE="text [variablename]" ITEMLEVELVARIABLE="text [variablename]" RESULTDATASET="text" />

See Also

Get Selected Tree Item-Setting Properties, Get Selected List Item, Select List Item, Select Tree Item, Loop List Control , Loop Tree Control, Get Text

Description

Retrieves the currently selected item or items of a tree control. The control can be selected from an existing window either by using the Browse button or by dragging the AutoMate icon to the area on the screen.

Practical Usage

Used to retrieve the text contents or indent level of the currently selected item on a tree control.

Important: Only standard Windows tree controls will work with the Get Selected Tree Item action. Many applications use images or other controls that may act like tree controls but they are not native Windows controls; the Get Selected Tree Item action will not work with these controls.

Parameters

General Tab

To access these properties, select the target control by dragging the AutoMate icon, and then click the Edit button under Object Description.

Window Title Must Be

Text, Required
MARKUP:
a) WINDOWTITLE="Desktop"
b) WINDOWTITLE="*"

Specifies the title of the window to act on. The value is not case sensitive. This parameter supports wildcard characters (* and ?). For example "*Internet Explorer*" would include all windows containing Internet Explorer.

Note: A Window title is required because without this parameter, the action would have to search every control of every window on the system, which would take an unacceptable amount of time. To ignore the window title, use a wildcard character (* or ?); if this parameter is left blank, the action assumes it is searching for a window title that is blank.

Window Class Must Be

Text, Required
MARKUP: WINDOWCLASS="Outlook Express Browser Class"

Specifies the class of the window to act on. The value is not case sensitive. This parameter supports wildcard characters (* and ?). For example "*Explore*" would include all window classes containing Explore.

Note: If this parameter is left blank, the action assumes it is searching for a window class that is blank; to ignore the window class, use a wildcard character (* or ?).

Window Handle Must Be

Number, Optional, Default: 0
MARKUP: WINDOWHANDLE="555735"

Specifies the handle of the window to act on. If set to 0 or omitted, this parameter is ignored.

Object Type Must Be

Yes/No, Optional, Default: NO
MARKUP: CHECKOBJECTTYPE="YES"

When set to YES, specifies that the object type parameter will be used to identify the control. If set to NO, the type of the control is ignored.

Object Type

Text, Optional, Default: (blank)
MARKUP: OBJECTTYPE="TreeStructure"

Specifies the type of control that should be used in the action. Valid only if Object type must be [CHECKOBJECTTYPE] is set to YES.

Object Class Must Be

Yes/No, Optional, Default: NO
MARKUP: CHECKOBJECTCLASS="YES"

When set to YES, specifies that the object class parameter will be used to identify the control. If set to NO, the class of the control is ignored.

Object Class

Text, Optional, Default: (blank)
MARKUP: OBJECTCLASS="SysTreeView32"

Specifies the class of control that should be used in the action. Valid only if Object class must be [CHECKOBJECTCLASS] is set to YES.

Object Name Must Be

Yes/No, Optional, Default: NO
MARKUP: CHECKOBJECTNAME="YES"

When set to YES, specifies that the object name parameter will be used to identify the control. If set to NO, the name of the control is ignored.

Object Name

Text, Optional, Default: (blank)
MARKUP: OBJECTNAME="Cancel"

Specifies the name of the target control. Valid only if Object name must be [CHECKOBJECTNAME] is set to YES.

Object Value Must Be

Yes/No, Optional, Default: NO
MARKUP: CHECKOBJECTVALUE="YES"

When set to YES, specifies that the object value parameter will be used to identify the control. If set to NO, the value of the control is ignored.

Object Value

Text, Optional, Default: (blank)
MARKUP: OBJECTVALUE="1"

Specifies the value of the target control. Valid only if Object value must be [CHECKOBJECTVALUE] is set to YES.

Object Position Must Be

Yes/No, Optional, Default: NO
MARKUP: CHECKOBJECTPOSITION="YES"

When set to YES, specifies that the Position X and Position Y parameters will be used to identify the control. If set to NO, the position of the control is ignored. The X and Y coordinates specified are relative to the window specified in the Window Title [WINDOWTITLE] parameter (not the screen).

Object Position X

Text, Optional, Default: (blank)
MARKUP: OBJECTXPOS="80"

Specifies the X coordinate position of the control relative to the window specified in the Window Title [WINDOWTITLE] parameter. The parameter is ignored if Position must be [CHECKOBJECTPOSITION] is set to NO.

Object Position Y

Text, Optional, Default: (blank)
MARKUP: OBJECTYPOS="90"

Specifies the Y coordinate position of the control relative to the window specified in the Window Title [WINDOWTITLE] parameter. The parameter is ignored if Position must be [CHECKOBJECTPOSITION] is set to NO.

Advanced Tab

Populate Variable With Indentation Level

Variable, Optional, Default: (blank)
MARKUP: ITEMLEVELVARIABLE="myvariablename"

Specifies the name of an already existing variable that should be populated with the level of indentation for the selected  item.

Create and Populate Dataset

Text, Optional, Default: (blank)
MARKUP: RESULTDATASET="DatasetName"

Specifies the name of a dataset to be created and populated with data from the selected tree item or items. In addition to the standard dataset fields, the dataset will contain the following:

Notes

Window Dissection™ Technology

This action contains a subset of Network Automation's unique "Window Dissection Technology".

Click here for more information.

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMGETSELECTEDTREEITEM WINDOWTITLE="Desktop" OBJECTCLASS="SysTreeView32" OBJECTTYPE="TreeStructure" CHECKOBJECTCLASS="YES" CHECKOBJECTTYPE="YES" RESULTVARIABLE="VariableName1" ITEMLEVELVARIABLE="VariableName2" RESULTDATASET="DatasetName" />