Sub Main
Dim intReturn As Integer
' The Action2 FTP methods (with the exception of
' FTPQuickSend and FTPQuickRetrieve may not
' function properly in the AutoMate™ BASIC IDE. To
' more accurately use these functions, run the script from
' within an AutoMate™ task using the “Run a BASIC
' Script” action.
Dim varHost As Variant
Dim varUserName As Variant
Dim varPassword As Variant
Dim intPort As Integer
Dim varFTPLogFile As Variant
Dim intOverwriteLog As Integer
Dim intPassiveMode As Integer
Dim varLocalFile As Variant
Dim varRemoteFile As Variant
Dim intTransType As Integer
varHost = "www.hostname.com"
varUsername = "username"
varPassword = "password"
intPort = 21
varFTPLogFile = "c:\ftp.log"
intOverwriteLog = 1
intPassiveMode = 0
varLocalFile = "c:\"
varRemoteFile = "/*.txt"
Action2.FTPLogin (varHost, varUsername, varPassword, intPort, varFTPLogFile, intOverwriteLog, intPassiveMode)
intReturn = Action2.FTPDownload (varRemoteFile, varLocalFile, intTransType)
Action2.FTPLogout
If intReturn = 0 Then
MsgBox "Failure"
MsgBox( Action2.GetLastError )
ElseIf intReturn = 1 Then
MsgBox "Success"
End If
End Sub