FTPLogin Method

Action2 Example

 

Encapsulates the AutoMate™ action in the “FTP” group, “FTP Login.” The method attempts to connect AutoMate™ to an FTP server.

 

Declaration

function FTPLogin (varHost As Variant,

varUsername As Variant,

varPassword As Variant,

intPort As Integer,

varFTPLogFile As Variant,

intOverwriteLog As Integer,

intPassiveMode As Integer) As Integer

 

Parameters

varHost

 The hostname or IP address of the FTP server to connect to.

 

varUsername

 The username used to log in to the server. For anonymous login, try “anonymous”

 

varPassword

 The clear text password to be used to login to the server. For anonymous logins, try your email address (e.g. user@rockon.com)

 

intPort

 The port number to connect to on the FTP server. Most FTP servers use port 23.

 

varFTPLogFile

 The full path to a logfile on your local system that AutoMate™ can use to write session information to. If the file does not exist, AutoMate™ will create it first.

 

intOverwriteLog

 Specifies whether or not AutoMate™ should overwrite the file specified by varFTPLogFile if the file already exists. Set to “1” to overwrite the file or set to “0” if you wish to append logging to the end of the file.

 

intPassiveMode

 If the local machine or remote machine is behind a firewall, it may be necessary to use the FTP commands in passive mode. To do this, set intPassiveMode to “1.” Otherwise, set to “0.”

 

Description

The FTPLogin method attempts to connect to the FTP server specified by varHost on the port intPort, using the username specified by varUsername and the password specified by varPassword.

 

Use the FTPLogin method to establish a persistent connection to an FTP server. Once a connection is made, you can use the other FTP commands to upload, download, rename, and delete files on the FTP server. This differs from the FTPQuickUpload and FTPQuickDownload methods, which connect to a server, perform one action, and then disconnect.

 

When finished with the FTP server, call the FTPLogout method to cleanly disconnect from the server.

 

NOTE: 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.