If Action Icon

If Compare Files



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


Compares two files using the specified criteria and returns TRUE or FALSE depending on the outcome.

Practical Usage

Very often when you create a task, you want it to perform different actions for different decisions. You can use conditional statements in your code to do this. The If Compare Files is a conditional statements that can perform different actions during the course of a task depending on the result of an expression evaluation. If the result evaluates to TRUE, AutoMate will execute the block of steps immediately following the If action up until an End If step is encountered, otherwise the block will be skipped (or if an Else statement is encountered it will execute that block of steps).

NOTE: All If actions must be followed at some point with an End If step to mark the end of the code block that is to be executed if the expression is true.


General Properties


File A





The file to compare against the one specified in the File B field. You may enter the path and file name manually or click the Folder icon and navigate to the desired file.

File B





The file to compare against the one specified in the File A field. You may enter the path and file name manually or click the Folder icon and navigate to the desired file.

Compare Type

Text (options)




The criteria to use when comparing the two files. The available options are:

  • Size (Default)

  • CRC/Hash

  • Creation Date

  • Modified Date

  • Last Accessed Date

  • Attributes


Text (options)

Yes if compare type is  CRC/Hash



The Algorithm to use when comparing the two files. Valid only if the Compare Type option selected is CRC/Hash. The available options are:

  • CRC

  • MD5

  • SHA1

  • SHA256

  • SHA356

  • SHA512


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 lets you 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 & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder


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


Description: Compare file "C:\Documents and Settings\marie.black\My Documents\dungeon.txt" with file "C:\Documents and Settings\marie.black\My Documents\bpaserver.txt". Compare hash values. Use the CRC hash algorithm.


<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" />


↑ [Top of Page]