Script Library

Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.


email_custom_error_messages.s

Download

A common requirement is to send email notifications when certain errors are encountered.

Robo-FTP enables you to check for success / failure of any command (sufficient for most purposes) with the IFERROR command. You can also use variants of the IFERROR command such as IFERROR= to check for specific error messages.

The Help file contains full documentation for IFERROR and related commands, including many examples.

This simple example attempts to set the local working directory. If it is unable to do so, it generates a custom error message and sends an email notification using the default email configuration from the Robo-FTP Configurator. Launch the Configurator, click on "Outbound Email (SMTP)," and then click "Add" to create a default outbound email connection.


  1  set localdir = "C:\some\directory"
  2  SET ErrorMsg = "Could not change working directory to " & localdir
  3  WORKINGDIR localdir
  4  IFERROR goto failed
  5  ;; Do more processing here
  6  :done
  7  EXIT
  8  :failed
  9  ;; There was an error, so send custom email message
 10  SET mailbody = ErrorMsg & %crlf & %lasterrormsg
 11  EMAIL mailbody /subject="RoboFTP Error!"
 12  EXIT /exitcode=2000

Browse complete list of scripts