Loop - End loop
Declaration
<AMLOOP ACTIVITY="end" />
Description
Marks the end of a block of steps that is to be looped by any of the Automate Desktop Loop actions.
Practical usage
Used with any loop step to mark the end of the block of steps to be looped during runtime.
Parameters
There are no parameters for this activity.
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Example 1
The Loop activity used to loop a total of 5 times. A Message Box is contained inside the Loop / End Loop block to display the sequencing of each iteration.
<AMVARIABLE NAME="theCounter" VALUE="" />
<AMLOOP TOTALLOOPS="5" RESULTVARIABLE="theCounter"><AMMESSAGEBOX>This is iteration number %theCounter%.</AMMESSAGEBOX></AMLOOP>
<AMSHOWDIALOG>This is iteration number %theCounter%.</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />
Example 2
The Loop activity used to loop through a range with the starting index set to 1 and the ending index set to 10. The number by which the index is increased by is set to 3. A Message Box is contained in the body of the loop to display the current index during each iteration.
<AMVARIABLE NAME="theCounter" VALUE="" />
<AMLOOP FROM="1" TO="10" STEP="3" RESULTVARIABLE="theCounter"><AMMESSAGEBOX>This is index %theCounter%.</AMMESSAGEBOX></AMLOOP>
<AMSHOWDIALOG>This is index %theCounter%.</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />