If Action



See Also

If Action-Setting Properties, Else Action, End If Action, The BASIC Language All Groups


Begin a block of steps that are executed conditionally.

Practical Usage

"If" is an extremely useful action. It allows decisions to be made during the execution of the task depending on the result of an expression evaluation. Some examples of simple (although impractical) expressions are: as 1=1 (true). Or 1>2 (false).

Of course the kinds of expressions more likely to be used in the "If" action are: city = "Los Angeles" or count = 100. If the result evaluates to TRUE, AutoMate will execute the block of steps immediately following the If action up until an End If is encountered, otherwise the block will be skipped (or if an Else <AMELSE> statement is encountered it will execute that block of steps). All If actions must be followed at some point with an End If <AMENDIF> to mark the end of the code block that is to be executed if the expression is true.


General Tab


Text, Optional

Specifies a valid BASIC expression.


Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

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


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

<!-- A simple useless test - should result to true--->
  <AMMESSAGEBOX MESSAGETEXT="the result was true">


<!-- Another useless test with AMELSE - should result to false--->
  <AMMESSAGEBOX MESSAGETEXT="the result was true">
  <AMMESSAGEBOX MESSAGETEXT="the result was false">

<!-- Check if it is Friday! Using functions and AMELSE - in this example it will only work if it is actually Friday--->
<AMIF EXPRESSION="Day (Now()) = 5">
  <AMMESSAGEBOX MESSAGETEXT="It is not Friday. Lame.">