Variables

Top  Previous  Next

 

User-defined script variables are created and assigned values by the SET or SETNUM script commands. The names of user-defined variables begins with at least one alphabetic character and may be up to 255 characters in length. The maximum length of user defined variables is 4096 characters.

 

Internal variables are automatically created and assigned values by the Robo-FTP script processor. You should familiarize yourself with the list of internal variables because they can make certain script development tasks much easier. The names of internally defined variables all begin with a percent "%" character.

 

Variables are not case-sensitive. For example, abc and ABC are the same variable. Up to 4096 variables may be assigned at one time.

 

Once a variable is created it remains defined for the duration of an active script file or until it is unassigned with the SET command. The values assigned to script variables may be up to 1020 characters in length. Examples of alphanumeric variables are shown below:

 

SET connection = "Connection 2"

DIALNET connection

SET file name = "c:\anyfile"

DELETE file_name

 

Robo-FTP script files may perform substring manipulation on variables. The SETLEFT, SETRIGHT, and SETMID commands allow extraction of substrings from the left to right, right to left, and from mid string respectively.

 

Robo-FTP script files may also perform basic arithmetic manipulation on numeric variables. The INC and DEC commands allow incrementing and decrementing of numeric strings while the SETNUM command permits adding, subtracting, multiplication, and division. Examples of numeric variables are shown below:

 

SETNUM x = 1

SETNUM e = m x c x c ;; (hint: e = mc2)

INC x

 

Variables containing dates may be modified with the DATEADD, DATESUB, DATETIMEADD and DATETIMESUB script commands.

 

 

Related command(s): SET, SETLEFT, SETRIGHT, SETMID, SETLEN, SETEXTRACT, SETSUBSTR, SETNUM, DEC, INC

See also: Passing External Values Into Command Scripts, Internal Script Variables