If Compare Files Action



See Also

If File Exists Action, If Folder Exists Action, If Text Contains Action, Else Action, End If Action, The BASIC Language All Groups


Compares two files and fails the step if the files are different.

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

File A

Text, Required
MARKUP: FILEA="C:\Foldername\FileA.txt"

Specifies one file to compare with another.

File B

Text, Required
MARKUP: FILEB="C:\Foldername\FileB.txt"

Specifies a second file to compare against File A.

Compare Type

Text, Required


Specifies the criteria to use when comparing the two files.

The available options are:


Text, Required


If selecting CRC/Hash from the Compare Type parameter, the Algorithm drop-down activates.

The available options are:


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.

<AMIF TYPE="COMPAREFILES" FILEA="C:\Documents and Settings\marie.black\My Documents\dungeon.txt" FILEB="C:\Documents and Settings\marie.black\My Documents\bpaserver.txt" COMPARETYPE="CRC" HASHTYPE="CRC" />