Label Action Icon

Label

Declaration

 

<AMLABEL LABELNAME="text">

 

See Also

If, If Compare Files, If Folder Exists, If Last Step, If Pixel Exists, If Process Running, If Text Contains, If Windows Exists, End If, End Select/Case, Goto, Select/Case, Else

Description

Labels a point in a task with a specific name. Can be used with the Goto action or On Error Goto to direct task execution to a different point of the task.

Practical Usage

This action does not have an effect on task execution, it only defines a point in a task. Please see, Goto Action for usage information.

IMPORTANT: Excessive use of Goto can create tasks that are difficult or impossible to debug. If your task requires more than a few goto steps it is recommended to consider re-structuring with "Sub-tasks" (using the Start Task Action). In many programming  languages, the use of even one Goto statement is considered bad programming practice. Use at your own risk!

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Label Name

Text

Yes

(Empty)

LABELNAME="problemhandler"

The name of the label.

 

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties allows you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables and Functions

All text fields allow the use of expressions such as variables, functions or AutoMate extended functions, which can be entered by surrounding the expression in percentage signs (example: %FileDateTime(myVar)% or %myVar%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on function

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

This example uses an If File Exists action to determine if a specific file does not exist in the system. If TRUE, the task will perform a one-way jump to the line where the Label step is located.

 

<AMIF ACTION="not_exist" FILE="C:\Temp\test.txt">

     <AMGOTO LABELNAME="bugHandler" />

</AMIF>

<AMFILECOPY SOURCE="C:\Temp\test.txt" DEST="C:\\Monthly_Backup\Archive\test.txt"/>

<AMSTOPTASK STATUSTYPE="SUCCESS" />

<AMLABEL LABELNAME="bugHandler" />

<AMMESSAGEBOX>File not found!</AMMESSAGEBOX>

 

↑ Top of Page