Command Syntax

Top  Previous  Next

 

Script commands consist of an opcode followed by arguments and then options. The general syntax of a Robo-FTP script command is shown below:

 

opcode [argument1] … [argumentN] /option1 … /optionN

 

Arguments

Arguments are one of the following types:

 

an alpha-numeric string constant (enclosed in single or double quotes)
a numeric constant
a variable (names starting with alphabetic character, %, or $ symbol)

 

Optional Arguments

Most script command arguments are required, even if you are only passing an empty string. When a script command argument is truly optional that fact will be explicitly stated in this manual.

 

 

Options

Options begin with the slash "/". Many commands support multiple options. Examples of command options are below:

 

RCVFILE /timeout=0

SENDFILE "example.txt" /archive

FTPLOGON "ftp.secure.com" /servertype=FTPSDATA /trust=ALLOW

 

 

Variables and Constants

String constants passed to command arguments must be enclosed in quotes because the script parser uses quotes to differentiate between constants and variables when inspecting command arguments. Consider the following example that shows passing variables and constants to the arguments of the WRITEFILE command:

 

SET MyFile = "YourFile.txt"

WRITEFILE MyFile "This is the first line in my text file."

WRITEFILE "MyFile" "This is the first line in my text file."

 

On the second line of the example above, a variable named MyFile is passed to the first argument of the WRITEFILE command. The value stored in the variable is "YourFile.txt" so the WRITEFILE command writes to a file named YourFile.txt. On the third line of the example, a string constant containing the value "MyFile" is passed to the first argument of of the WRITEFILE command so a file named MyFile is written. On both the second and third lines the second argument is a string constant enclosed in quotes.

 

String constants passed to command options may be enclosed in quotes. When the value of a command option is enclosed in quotes it is parsed as a string constant. When the value of a command option is not enclosed in quotes, the script parser checks for a variable with the same name; if no variable is found then the value is used as a string constant.

 

The following two commands are equivalent except when there is an existing user-defined variable named Bob or Secret:

 

FTPLOGON "ftp.MyServer.com" /user="Bob" /pw="Secret"

FTPLOGON "ftp.MyServer.com" /user=Bob /pw=Secret

 

This manual contains numerous examples of string constants passed to options without using quotes but this only works for values without internal spaces. The password option in the following example contains a space character so it must be enclosed in quotes:

 

FTPLOGON "ftp.MyServer.com" /user=Bob /pw=My Secret ;; error invalid argument!

FTPLOGON "ftp.MyServer.com" /user=Bob /pw="My Secret"

 

An error occurs in the first row (without the quotes) because the script parser sees the value of the password option as "My" and the remaining "Secret" as an invalid argument.

 

 

See also: List of Script Commands