Task - Stop
Declaration
<AMTASK ACTIVITY="stop" STATUSTYPE="text (options)" ERRORNUMBER="number" ERRORTEXT="text" />
Description
Stops execution of the current task. Supports status code output, including Success, Stop, or Error. If the status code is set to Error, this activity supports output of a custom error number and/or text to the Automate Desktop Event Log.
Practical usage
Commonly used inside an If activity to immediately stop execution of the current task if a certain condition is met. Conveniently returns a status or error number/text to output to other applications.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Status type (unlabeled) | Text (options) | Yes | Aborted |
|
The
type of status to return when the task stops. The selected status
will appear in the Automate Desktop Event Log. The available options are:
|
Custom error number | Number | Yes | (Empty) | ERRORNUMBER="123" | The
user-defined error number to return when the task
stops. This parameter becomes available and is required if the Status
type parameter is set to Error. NOTE: 0 is a reserved system error number and is not available for use. |
Custom error text | Text | No | (Empty) | ERRORTEXT="ErrorBad" | The user-defined error text to return when the task stops. This parameter becomes available if the Status type parameter is set to Error. |
Examples
- 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
This sample task stops a task and throws error number 8080 and error text ErrorBad.
<AMTASK ACTIVITY="stop" STATUSTYPE="ERROR" ERRORNUMBER="8080" ERRORTEXT="ErrorBad" />
Example 2
This sample task stop a task if the condition in step 1 returns FALSE.
<AMIF EXPRESSION="1 = 2" USECOMPLEXUI="YES" />
<AMSHOWDIALOG MESSAGE="If the previous step returns TRUE, this message box will be displayed" />
<AMELSE />
<AMSHOWDIALOG MESSAGE="If the previous step returns FALSE, this message box will be displayed and the following step will stop this task" />
<AMTASK ACTIVITY="stop" />
<AMIF ACTIVITY="end" />