Command$

Program flow control function.

The Command$ function allows a calling script to use the parameters from the called script.

Syntax

var$=command$(<number>)

Parameter

<number>, numeric: the number of the parameter on the command line used to launch the script. Number 0 is the name of the script itself (including its path). So command$(0) will always return the full name of the running script. Parameters are strings separated by blanks.

Return value

var$ gives the <number> parameter on the command line used to launch the script. If the parameter <number> does not exist, an empty string is returned.

See also

Parameters passed from one script to another

Example

Script 1

Run("script2 param1 param2")

Script 2

msgbox(command$(1)) ' displays param1

msgbox(command$(2)) 'displays param2

Example code

Script 1 (calling.src) :

Parm1$="Param1"

Parm2$="Param2"

 

Script_Path$="c:\taskware\scripts\"

 

Program$=Script_Patht$+"called.rob "+Parm1$+" "+Parm2$

 

run(Program$)

 

Script 2 (called.src) :

Rem Displays the program name

a$=command$(0)

Message$="Program name : " + a$

msgbox(a$)

 

Rem Displays the first parameter

a$=command$(1)

Message$="Parameter 1 : " + a$

msgbox(a$)

 

Rem Displays the second parameter

a$=command$(2)

Message$="Parameter 2 : " + a$

msgbox(a$)