Get Selected List Item Action

Declaration

<AMGETSELECTEDLISTITEM ACTION="options" WINDOWTITLE="text" OBJECTCLASS="text" OBJECTTYPE="text" CHECKOBJECTCLASS="yes/no" CHECKOBJECTTYPE="yes/no" CHECKOBJECTPOSITION="yes/no" OBJECTXPOS="text" OBJECTYPOS="text" RESULTVARIABLE="text" INDEXVARIABLE="text" RESULTDATASET="text">

See Also

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

Description

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

Practical Usage

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

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.

Parameters

General Tab

Action

Options, Optional - Default first
MARKUP:
a) ACTION="first_selected"
b) ACTION="last_selected"
c) ACTION="all_selected"

Specifies how selected items should be retrieved.

The available options are:

After selecting the target control by dragging the AutoMate icon, click the Edit button under "Object Description" to access these properties:

Window Title

Text, Required
MARKUP: WINDOWTITLE="Microsoft Internet Explorer"

Specifies the title of the Window that the control search should be restricted to. The value is case-insensitive. NOTE: 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

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

Specifies the class of the Window to act on. The 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

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

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

Type Must Be

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

Specifies that the type parameter will be checked against the control when determining a matching control. When set to NO the type of the control is ignored.

Type

Text, Optional Default ""
MARKUP: OBJECTTYPE="PushButton"

Specifies the type of control that should be checked/unchecked/toggled. The parameter is ignored if "Type must be" is set to NO.

Class Must Be

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

Specifies that the class parameter will be checked against the control when determining a matching control. When set to NO the class of the control is ignored.

Class

Text, Optional Default ""
MARKUP: OBJECTCLASS="SysTreeView32"

Specifies the class of the target control. The parameter is ignored if "Class Must be" is set to no.

Name Must Be

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

Specifies that the name parameter will be checked against the control when determining a matching control. When set to NO the name of the control is ignored.

Name

Text, Optional Default ""
MARKUP: OBJECTNAME="Cancel"

Specifies the name of the target control. The parameter is ignored if "Name must be" is set to NO

Value Must Be

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

Specifies that the value parameter will be checked against the control when determining a matching control. When set to NO the value of the control is ignored.

Value

Text, Optional Default ""
MARKUP: OBJECTVALUE="1"

Specifies the value of the target control. The parameter is ignored if "Value must be" is set to NO

Position Must Be

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

Specifies that the Position X and Position Y parameter will be checked against the position of the control when determining a matching control. When 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 Parameter (not the screen).

Position X

Text, Optional Default ""
MARKUP: OBJECTXPOS="80"

Specifies the X coordinate position of the control relative to the Window specified in the Window Title Parameter. The parameter is ignored if "Position must be" is set to NO.

Position Y

Text, Optional Default ""
MARKUP: OBJECTYPOS="90"

Specifies the Y coordinate position of the control relative to the Window specified in the Window Title Parameter. The parameter is ignored if "Position must be" is set to NO.

Advanced Tab

Item Text Variable Name

Variable, Required
MARKUP: RESULTVARIABLE="myvariablename"

Specifies name of the AutoMate variable that should be populated with the contents of the desired control at runtime.

Item Index Variable Name

Variable, Optional Default ""
MARKUP: INDEXVARIABLE="myvariablename"

Specifies name of the AutoMate 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.

Return all Columns Dataset

Text, Optional Default ""
MARKUP: RESULTDATASET="mydatasetname"

Specifies name of the AutoMate dataset that should be created and populated with the data from all the coumns 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.

Notes

A variable field Dataset is generated

A dataset is a multiple column, multiple row container object. This action creates and populates a dataset, the fields contained within that dataset are determined by the query that was executed. For example if the following query is executed:

SELECT firstname, lastname, company from customer where city='Los Angeles';

Then the following data set would be generated:

datasetname
|--firstname

|--lastname

|--company


along with the standard fields included in every dataset

|--CurrentRow

|--TotalRows

|--TotalColumns

|--ExecutionDate

|--RowsAffected

|--SQLQuery

|--Datasource

A record (row) is created for each record (row) that is retrieved from the server. To access this data use the Loop Dataset Action <AMLOOPDATASET> to loop through the records, inside the loop you can extract the data from the field of your choice (from the current record) by using an embedded expression such as the one that follows:

%mydatasetname.firstname%

or you could combine two fields together like this:

%mydatasetname.firstname + " " + mydatasetname.lastname%

Embedded Expressions such as these can be used in any parameter in any action. So, to display the data in a message box the AML code would look like this:

 <AMMESSAGEBOX MESSAGETEXT="%mydatasetname.firstname%" WINDOWTITLE="The firstname of the current record is">

At runtime the text %mydatasetname.firstname% is replaced by the contents of the subject of the current record.

More on datasets

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.

<AMGETSELECTEDLISTITEM WINDOWTITLE="My Documents" OBJECTCLASS="SysListView32" OBJECTTYPE="List" CHECKOBJECTCLASS="YES" CHECKOBJECTTYPE="YES" CHECKOBJECTPOSITION="YES" OBJECTXPOS="300" OBJECTYPOS="119" TEXTVARIABLE="variablename">