Testing Script Actions

Script actions are tested using the If/End_If command set.  These commands divide the script into separate blocks.  The rule is this:

All actions preceding an IF, Else, or End_If command must be completed before any action following the command will be processed

There are currently two conditions that may be test: successful completion of preceding actions, and file presence.  The test for successful completion verifies the status of all actions in the script since the last conditional command.  If these actions were successful, the CompletedOK test is true.  Otherwise the test is false.

The test for file presence is independent of the preceding actions.  The completion status of the actions is ignored, and the test simply hinges on the presence or absence of the specified file.  This may be an individual file, or a mask that tests for a pattern.  The script may be instructed to wait a specified period of time for the file to appear or disappear.  If the pattern detects a match, the Present condition is true.  Otherwise the test is false.

In the example from the preceding topic, a conditional corrects the ambiguity of when the delete is processed:

          :From: C:\Source\Test.file
          :To:      {ftp:Server}C:\Target\Test.file

          :If: Copies CompletedOK

            :Delete_Files:C:\Source\Test.file

:If: Not Delete CompletedOK

                        :Stop:

:End_If:

:Else:

            :Stop:

:End_If:

Now, the transfer will run to completion and be tested for success.  If the transfer fails, the script will end.  If the transfer succeeds, the source file is then deleted.  We also test for a successful delete.