Loop - List Control

Declaration

<AMLOOP ACTIVITY="listcontrol" WINDOWTITLE="text" 
ACCESSIBILITYENGINE="text (options)" 
OBJECTPROPERTIES="Toolkit=text (options),Type=,Class=,
Name=,Value=,X=,Y=" INCLUDE="text" EXCLUDE="text" 
SORT="text (options)" 
RESULTVARIABLE="text" RESULTDATASET="text"> 		 

Description: Loops through the items of a list box or list view and populates a variable with the current item text. With each successive loop, the next item is retrieved. The loop ends after all the elements have been browsed or when a Break is encountered.

IMPORTANT: Only standard Windows list controls will work with the Loop List Control action. Many applications use images or other controls that may act like list controls but they are not native Windows controls—the Loop List Control Action will not work with these controls.

Practical Usage

Used to perform some action an all items in a list box or list view.

General Parameters

Property

Type

Required

Default

Markup

Description

Populate variable with item text

Text

Yes

(Empty)

RESULTVARIABLE="theVar"

The name of an already existing variable that should be populated with the caption text of the node.

After selecting the target control by dragging the 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)

a) WINDOWTITLE="Desktop"
b) WINDOWTITLE="*"

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.

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 (e.g., * 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 (e.g., * or ?). This parameter is ignored if the Object position must be parameter is set to NO.

Advanced Parameters

Property

Type

Required

Default

Markup

Description

Include Window

Text

No

(Empty)

INCLUDE="d*"

Specifies a wildcard mask representing the items to include in the loop. For example, specifying D* returns only items that begin with the letter "D".

Exclude Window

Text

No

(Empty)

EXCLUDE="z*"

Specifies a wildcard mask representing the items to exclude from the loop. For example, specifying Z* returns no items that begin with the letter "Z".

Create and Populate Dataset

Text

No

(Empty)

RESULTDATASET="DatasetName"

Specifies the name of a dataset to be created and populated with data from the looped list. The dataset will contain a column for each column in the list control plus an index column for the index number of the list item.

Sorting

Text (options)

No

None

SORT="unsorted"

SORT="ascending"

SORT="descending"

Specifies the sort order to be applied to the values before the loop begins. The available options are:

  • none: results left in their natural order and not sorted

  • ascending: results sorted in ascending alphabetical order (A to Z)

  • descending: results sorted in descending alphabetical order (Z to A)

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: This task loops through items of a list. Within each iteration, a Speak action speaks out loud the current item on the list.

<AMVARIABLE NAME="VariableName1"></AMVARIABLE>
<AMSPEAK ENGINE="automatic">These are the items on the list
</AMSPEAK>
<AMLOOP TYPE="LISTCONTROL" WINDOWTITLE="My 
Documents" OBJECTCLASS="SysListView32" OBJECTTYPE="List" 
CHECKOBJECTCLASS="YES" CHECKOBJECTTYPE="YES" 
CHECKOBJECTPOSITION="YES" OBJECTXPOS="204" 
OBJECTYPOS="119" RESULTVARIABLE="VariableName1" 
EXCLUDE="*.txt" SORT="ascending" RESULTDATASET="DatasetName">
<AMSPEAK ENGINE="automatic">%VariableName1%</AMSPEAK>
</AMLOOP>