Get Selected List Item Action Icon

Get Selected List Item

 

Declaration

<AMGETSELECTEDLISTITEM WINDOWTITLE=text" OBJECTNAME="text" OBJECTCLASS="text" OBJECTTYPE="text" CHECKOBJECTNAME="Yes/No" CHECKOBJECTCLASS="Yes/No" CHECKOBJECTTYPE="Yes/No" RESULTVARIABLE="text" INDEXVARIABLE="text" ACTION="list(options)" />

See Also

Check | Click Mouse | Get Selected Tree Item | Get Text | Hold Down Key | Move Mouse | Move Mouse to Object | Press | Release Key | Select Item | Select List Item | Select Tree Item | Send Keystrokes | Set Text

Description

Retrieves the currently selected item(s) of a list box or a list view. To select an object from an existing window, use the Browse button or drag the AutoMate icon to the desired area on the screen.

IMPORTANT: Only standard Windows list controls will work with the Get Selected List Item Action, many applications use images or other controls that may act like a list control but they are not a native Windows control - the Get Selected List Item action will not work with these controls.

Practical Usage

Used to retrieve the text contents or item index number of the currently selected item(s) on a list or list view control.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

Action

Text (Options)

Yes

Check

  1. ACTION="first_selected"

  2. ACTION="last_selected"

  3. ACTION="all_selected"

Specifies how selected items should be retrieved. The available options are:

  • Get first item selected: If multiple items are selected, return only the text of the first selected item.

  • Get last item selected: If multiple items are selected, return only the text of the last selected item.

  • Get all items selected: If multiple items are selected return all the items selected in a comma-delimited list.

After selecting the target control by dragging the AutoMate icon to the desired object, the "Object Description" section will be populated with the characteristics of the control. Click the Edit button to access/edit the following properties:

Window Title must be

Text

Yes

(Empty)

WINDOWTITLE="Microsoft Internet Explorer"

If enabled, specifies the title of the Window that the control search should be restricted to. This value is case-insensitive. A Window title is required because without this parameter the action would have to search every control of every single Window on the system which would take an unacceptable amount of time. This parameter supports wildcards (* and ?), for example "*Internet Explorer* would include all Windows containing that text.

NOTE: If this parameter is left blank, the action assumes it is searching for a Window title that is blank - to ignore the Window title, use *.

Window Class must be

 

Text

No

(Empty)

WINDOWCLASS="Outlook Express Browser Class"

If enabled, specifies the class of the Window to act on. This value is case-insensitive. This parameter supports wildcards (* and ?), for example "*Internet Explorer* would include all window classes containing that text.

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 *.

Window Handle must be

Number

No

(Empty)

WINDOWHANDLE="555735"

If enabled, 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

Yes

Yes

CHECKOBJECTTYPE="YES"

If set to YES, specifies that the type parameter will be checked against the control when determining a matching control. If set to NO the type of the control is ignored.

NOTE: This action requires an object type, therefore, this parameter must be set to YES.

Object type (Text-box)

Text

Yes

(Empty)

OBJECTTYPE="PushButton"

Specifies the type of control that should be checked. This parameter is ignored if the Object type must be parameter is set to NO.

Object class must be

Yes/No

No

No

CHECKOBJECTCLASS="YES"

If set to YES, specifies that the class parameter will be checked against the control when determining a matching control. If set to NO the class of the control is ignored.

Object class (text-box)

Text

No

(Empty)

OBJECTCLASS="SysTreeView32"

Specifies the class of the control that should be checked. This parameter is ignored if the Object class must be parameter is set to NO.

Object name must be

Yes/No

No

No

CHECKOBJECTNAME="YES"

If set to YES, specifies that the name parameter will be checked against the control when determining a matching control. If set to NO, the name of the control is ignored.

Object name (text-box)

Text

No

(Empty)

OBJECTNAME="Cancel"

Specifies the name of control that should be checked. This parameter is ignored if the Object name must be parameter is set to NO.

Object value must be

Yes/No

No

No

CHECKOBJECTNAME="YES"

If set to YES, specifies that the value parameter will be checked against the control when determining a matching control. If set to NO, the value of the control is ignored.

Object value (text-box)

Text

No

(Empty)

OBJECTVALUE="1"

Specifies the value of control that should be checked. This parameter is ignored if the Object value must be parameter is set to NO.

Object position must be

Yes/No

No

No

CHECKOBJECTPOSITION="YES"

If set to YES, specifies that the X and Y coordinates will be checked against the position of the control when determining a matching control. If set to NO, the position of the control is ignored.

NOTE: The X and Y coordinates specified are relative to the Window specified in the Window Title Parameter (not the screen).

Position X

Text

No

(Empty)

OBJECTXPOS="80"

Specifies the X coordinate position of the control relative to the Window specified in the Window title must be parameter. To specify variable coordinates, use wildcard characters (i.e. * or ?). This parameter is ignored if the Object position must be parameter is set to NO.

Position Y

Text

No

(Empty)

OBJECTYPOS="90"

Specifies the Y coordinate position of the control relative to the Window specified in the Window title must be parameter. To specify variable coordinates, use wildcard characters (i.e. * or ?). This parameter is ignored if the Object position must be parameter is set to NO.

Advanced Properties

Property
Type
Req'd
Default
Markup
Description

Populate variable with item text

Text

No

(Empty)

RESULTVARIABLE="theVar"

The name of the variable that should be populated with the contents of the desired control at runtime. This parameter is active only if the Return values option selected is First column only.

Populate variable with item index

Text

No

(Empty)

INDEXVARIABLE="indexVar"

The name of the variable that should be populated with the index of the selected item(s). If multiple items are selected, then multiple indexes will be returned in a comma-delimited list. This parameter is active only if the Return values option selected is First column only.

Create and populate dataset

Text

No

(Empty)

RESULTDATASET="mydataset"

The name of the dataset that should be created and populated with the data from all the columns of the list view. If multiple items are selected, then multiple rows will be returned in the dataset, each field will be a new column in the dataset. More details about the dataset that this action creates can be found below under Notes. This parameter is active only if the Return values option selected is All the columns displayed in Details view.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Properties

The On Error tab allows you to determine what the task should do if a particular step encounters an error.

More about On Error properties

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. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name

Type

Return Value

theDataset.Title

Text

Returns the title of the window that holds the list of items.

theDataset.Class

Text

Returns the class of the window that holds the list of items.

theDataset.Index

Number

Returns the total number of indexes associated to the list of items.

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (Example: %myVariable% or %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking the Insert expression/variable button or pressing F2.

More on variables
More on expressions
More on the Expression Builder

Window Dissection™ Technology

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

Click here for more information

Example

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

 

Description: Get all items selected in list view: (class = "DirectUIHWND", name = "Items View", type = "List", value = "", X = "", Y = "", check class = "YES", check name = "YES", check type = "YES", check value = "NO", check position = "NO").  Populate variable "theVar" with text item.  Populate variable "theIndex" with index item.  The object must be in the window "Temp".  

 

<AMGETSELECTEDLISTITEM WINDOWTITLE="Temp" OBJECTNAME="Items View" OBJECTCLASS="DirectUIHWND" OBJECTTYPE="List" CHECKOBJECTNAME="YES" CHECKOBJECTCLASS="YES" CHECKOBJECTTYPE="YES" RESULTVARIABLE="theVar" INDEXVARIABLE="theIndex" ACTION="all_selection" />

 

↑ Top of Page