Sample VBScript Program

Top  Previous  Next

 

Robo-FTP may be called from VBScript (VBS) programs. The following is an example VBS program that loads Robo-FTP, logs on to the default FTP site, retrieves and displays the value of an internal Robo-FTP variable, and then logs off the site.

 

' Instantiate a Robo-FTP object

' -----------------------------

Set FTPReq = Createobject("RoboFTPAutomation.Automate")

 

If err.number <> 0 then

  Wscript.quit 1

End If

 

' Set connection properties and open connection

' ---------------------------------------------

ResultCode = FTPReq.RoboStartSession( "Sample", True, False, "" )

 

If ResultCode <> -1 then

  msgbox "RoboFtp Connection Error occured!"

  FTPReq.RoboEndSession

  Wscript.quit 2

End If

 

' log on to default site

' ----------------------

cmdString = "FTPLOGON"

ResultCode = FTPReq.RoboSendCommand( cmdString, 600)

 

' get the last error

' ------------------

msgbox FTPReq.RoboGetVBSVariable("%lasterror" )

 

 

' log off the site

' ----------------

cmdString = "FTPLOGOFF"

ResultCode = FTPReq.RoboSendCommand( cmdString, 600)

 

' end Robo-FTP session and exit

' -----------------------------

FTPReq.RoboEndSession

Wscript.Quit 0