RoboSendCommand        Method to send a script command to Robo-FTP

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Using Robo-FTP > Using COM/OLE to Control Robo-FTP > COM Methods >

RoboSendCommand        Method to send a script command to Robo-FTP

 

Overview

Method to send a script command to Robo-FTP.

 

C++ Definition

long RoboSendCommand( CString strCommand, long nTimeout )

 

VB Definition

RoboSendCommand( Command As String, Timeout As Long ) As Long

 

C# Definition

Int RoboSendCommand( CString strCommand, Int nTimeout )

 

VB.NET Definition

RoboSendCommand( Command As String, Timeout As Integer ) As Integer

 

Return Value

The numeric result code returned by Robo-FTP after the execution of a script command.

 

Returns >= ROBO_ERROR_FROM_ROBOFTP if the command was executed successfully by Robo-FTP. This value corresponds to one of Robo-FTP's script command result codes.

Returns ROBO_ERROR_CMD_IN_PROGRESS if the command is non-blocking and the command has been successfully initiated.

Returns ROBO_ERROR_TIMED_OUT if the command timed out.

 

See COM/OLE Return Codes below for a complete list of possible return values.

 

Parameters

strCommand / Command

A string defining the Robo-FTP script command to perform.

 

To have Robo-FTP simulate line numbers in the log file, precede the command with #{number} and a space character. For example, #100 FTPLOGON would result in a simulated line number of 100 being associated with this command.

 

nTimeout / Timeout

A long integer specifying the maximum period of time (10th of seconds) to wait for a blocking command to complete. This blocking status is determined by a parameter you previously passed to the RoboStartSession() method.

When the timeout period elapses the RoboSendCommand method stops blocking and returns execution control to your program. The parameter is ignored when the RoboSendCommand() is in non-blocking asynchronous mode.

 

Notice: Several common Robo-FTP script commands also support timeouts but those values are measured in full seconds rather than 10ths of seconds.

 

Remarks

The RoboStartSession() method must be called prior to calling RoboSendCommand(). This method blocks or returns immediately depending on the selection made in the RoboStartSession() method. If non-blocking is selected, the RoboCommandResult() event is fired when Robo-FTP completes the command.

 

If you send a conditional command (e.g., IFFILE or IFERROR) the conditional element of the command is evaluated and a TRUE/FALSE result is passed back but no actual branching action is taken.

 

For example, if the following script command is sent to Robo-FTP and the file exists Robo-FTP returns $ERROR_OLE_COMPARISON_TRUE; if file does not exist, the return value is $ERROR_OLE_COMPARISON_FALSE. The GOTO portion of the command is ignored since Robo-FTP is being controlled via the COM interface rather than executing a command script with branching labels.

 

IFFILE "c:\Program Files\Robo-FTP X.X\thisfile" GOTO found_it

 

If script labels are sent, they are ignored.