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.


download_lockbox_https.s

Download

Lockbox is a service offered by banks to help businesses streamline the way they receive checks from their customers. See this page for more details: Automated Lockbox Banking with Robo-FTP.

Part of the process involves downloading a daily lockbox file from the bank with information about deposits. You can then import this data into your accounting system.

This sample script shows how to download a daily lockbox file from Wells Fargo Bank using the HTTPS protocol. You can schedule this script using the built-in Robo-FTP Scheduler, the Windows Task Scheduler, etc.

Wells Fargo uses client certificates for authentication. They will generate and send you a certificate file you can use (usually sent as an email attachment with a file name like xxxxxxxxsftcert_20091201.p12).

You should first import this certificate into Robo-FTP by clicking the Choose Certificate button in the Configure SSL tab of the Robo-FTP Configurator. Once you are in the Choose Certificate dialog, browse for the certificate file in both the Certificate Field and Private Key File fields.

The sample script logs on to the server, downloads all files in the outbound directory (deleting files after a successful download), logs off, and exits.

In production, you could add email notifications, more robust error handling, etc.


  1  LOG "wells_fargo_lockbox" /new

  2  TRACELOG "wells_fargo_lockbox_trace" /new

  3  DELETE "sitelist.txt"
  4  FTPLOGON "sft.wellsfargo.com" /servertype=HTTPS /trust=all /clientcert

  5  FTPCD "outbound"
  6  ;; generate the sitelist.txt
  7  FTPLIST
  8  ;; throw out the first record as it is simply the total bytes present.
  9  READFILE "sitelist.txt" record
 10  IFERROR GOTO done
 11  ;; if there are no files, there are no records in the sitelist.txt
 12  :next_record
 13  READFILE "sitelist.txt" record /record=next
 14  IFERROR GOTO done
 15  DISPLAY record
 16  ;; last segment of line is the filename (filename should have no spaces)
 17  SETSUBSTR spaces = record " "
 18  SETNUM depth = spaces + 1
 19  SETEXTRACT filename = record " " depth
 20  RCVFILE filename /delete /nostatus

 21  IFERROR= $ERROR_SUCCESS GOTO next_record
 22  :done
 23  FTPLOGOFF
 24  EXIT

Browse complete list of scripts