CALL        Execute script file and return

Top  Previous  Next

Syntax:

CALL

[ file name ]  |  [ /options ]

Arguments:

[ file name ]

Variable or string defining a file or path name; if no path is defined the  current working folder is searched for a matching file; if no matching file is found Robo-FTP searches for the file in the folder of the calling script.

Options:

/silent

Do not echo script commands or results to log file or Robo-FTP window.

 

&arg&

Up to nine arguments may be passed to the called script in the same manner that they may be passed from the command line into Robo-FTP when it is launched; the first argument is saved in script variable %1, the second in %2, etc. up to %9.

 

 

Use of this script command temporarily transfers control to another script file. Unlike the CHAIN command, when the called script file exits, control returns to the original script file at the statement immediately following the CALL statement.

 

The following is an example of calling a script file and of the script file being called.

 

CALL "called_script.s"

 

Then the end of the called script file might contain the following:

 

DASHBOARDMSG "Now leaving called_script.s"

RETURN

 

Arguments may be passed to a called script using the double ampersand syntax. Any strings found between two ampersand delimiters (ie &value&) are saved in sequence in internal variables named %1 through %9 which are then accessible within the called script. The following example passes two arguments.

 

CALL "called_script.s" &arg1& &arg2&

 

When the called script is running, it will find %1 = “arg1” and %2 = “arg2”.

 

Note: any changes made to the Robo-FTP environment in a called script will persist after returning to the calling script. For example, if the working folder is changed the change will remain in effect upon the return. View called scripts as simply extensions to the original script, not as separate environments.

 

 

Related Command(s): CHAIN, EXEC, RETURN, WORKINGDIR

See also: Passing External Values Into Command Scripts