Loops through the items of a list box or list view. The variable specified is updated 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. Used to perform some action an all items in a list box or list view.
|
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. |
Declaration
<AMLOOP TYPE="LISTCONTROL" 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]" INCLUDE="text" EXCLUDE="text" SORT="text [options]" RESULTDATASET="text">
Example
<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>
See Also: Loop Tree Control
To set Loop List Control properties
In the Available Actions pane, open the Loop folder and double-click the Loop List Control action or drag it into the Steps pane.
In the Populate variable with item text box, select the variable to populate.
Open the window that contains the control, and display the list control you want to use.
Drag the icon from the Loop List Control dialog box into the list control. A black outline appears around the list control when it is selected. When you release the mouse, the dialog box is automatically populated with the list control specifications.
To change any of the list control specifications, click Edit and edit the specifications as needed.
To sort or limit the output from the list, click the Advanced tab and enter the properties as follows:
Use either Include items or Exclude items to enter all or part of the list items that you want to include or ignore. If you make entries in the Include items box, all items that do not match your entries will be ignored. If you make entries in the Exclude items box, only the specified items will be ignored and all others will be included. You can use asterisk (*) and question mark (?) as wildcard characters.
To populate a dataset with the list control data, select Create and populate dataset and enter a name for the dataset in the box. (Dataset names must be alphanumeric, begin with a letter, and contain no spaces.)
The dataset fields will match the columns of the list control, with an additional field for the current index.
If you want the items looped in ascending or descending alphabetical order, make your selection in the Sorting box. By default items are looped in the order they appear in the list.
To set the Description tab properties, refer to Description Tab Options.
To set the Error Causes and On Error tab properties, refer to Step Error Handling.
When finished, click OK to save settings and close the properties dialog box.
To auto-indent after all steps are added
In the Steps pane, hold down SHIFT and click the first and last steps in the block so that the complete block of steps is selected.
Click Format .
Populate Variable With Item Text
Variable, Required
MARKUP: RESULTVARIABLE="myvariablename"
Specifies an existing AWE variable that should be populated with the contents of the specified control at runtime.
Object Description
Select the target control by dragging the icon. Then click Edit to access these properties.
Window Title Must Be
Text, Required
MARKUP:
a) WINDOWTITLE="Untitled - Notepad"
b) WINDOWTITLE="*Internet Explorer*"
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="List"
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="SysListView32"
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.
Include
Text, Optional, Default: (blank)
MARKUP: 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
Text, Optional, Default: (blank)
MARKUP: 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, Optional, Default: (blank)
MARKUP: 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], Optional, Default: ("none")
MARKUP: SORT="ascending"
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)
This action includes the Description tab for entering a custom step description.
More on setting custom step description
This action also includes the standard Error Causes and On Error failure handling options/tabs.
More on Error Handling Options
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.