Loop - End loop

Declaration

<AMLOOP ACTIVITY="end" />

Related Topics   

Description

Marks the end of a block of steps that is to be looped by any of the Automate Loop actions.

Practical Usage

Used with any loop step to mark the end of the block of steps to be looped during runtime.

NOTE: By default, when any loop activity is added to the Steps pane of the Task Builder, it is automatically followed by an End Loop activity. This option can be disabled by editing the step in the Task Builder.

Parameters

There are no parameters for this activity.

Description

Error Causes

On Error

Example

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

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.

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

Copy
<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" />