Label - Goto
Declaration
<AMLABEL LABELNAME="text" />
Description
Sends task flow to the label indicated.
Practical usage
Used to direct the task to jump to a labeled section defined by the Label action. Make the Goto dependent on an If action or some other condition to avoid an endless loop between Goto and the label.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Label to Goto | Text | Yes | (Empty) | LABEL="bugHandler" | The name of a pre-existing label in the task in which to jump to. To create a label in a task, use the Label Action. |
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.
Description
This sample task checks if C:\Temp\test1.txt exists. If so, it will be copied to C:\Monthly_Backup\Archive\test1.txt and a subsequent step stops the task. If not, the task will skip to a label named bugHandler, at which point, a subsequent step will display a message dialog stating "File not found!"
<AMIF ACTIVITY="file_exist" FILE="C:\Temp\test1.txt" MODE="not_exist"><AMGOTO LABELNAME="bugHandler" /></AMIF>
<AMLABEL ACTIVITY="goto" LABELNAME="bugHandler" />
<AMIF ACTIVITY="end" />
<AMFILESYSTEM SOURCE="C:\Temp\test1.txt" DEST="C:\Monthly_Backup\Archive\test.txt" />
<AMTASK ACTIVITY="stop" STATUSTYPE="SUCCESS" />
<AMLABEL LABELNAME="bugHandler" />
<AMSHOWDIALOG MESSAGE="File not found!" />