Goto Action Icon

Goto

Declaration

<AMGOTO LABELNAME="text [label name]">

See Also

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

Description

Sends task flow to the label indicated.

Practical Usage

Used to direct the task to jump to a labelled 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.

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

Parameters

General Properties

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.

 

 

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 allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Properties

The On Error tab allows you to determine what the task should do if a particular step encounters an error.

More about On Error properties

Notes

Variables and Expressions

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.

More on variables
More on expressions
More on the expression builder

Example

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

 

Description: This sample task 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 action 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]