Running Scripts from the Command Line

You can run scripts from a command prompt without having to manually load and execute the script in Scripter. The same commands that you would type at a command prompt may also be entered as the "target" for a shortcut in order to link a shortcut button to a script. Enter the following to run a script from the command line or to link a shortcut to particular script file:

 

<Scripter path> -x filename.bas

 

where <Scripter path> represents the path to the Scripter program file (for example, C:\ProgramFiles\Golden Software\Voxler 4\Scripter\Scripter.exe") and filename.bas represents the name of the script to run. The space between the –x and the file name is required. This command opens the Scripter window, loads the specified script file, and runs the specified script. When the script terminates - either successfully or unsuccessfully - the Scripter window closes.

 

To load a script file but not execute it, the following command can be used:

 

<Scripter path> filename.bas

 

This opens the Scripter window and automatically loads the specified script file. The Scripter window remains open.

 

Passing a Command Line Argument to the Script

A single command line argument can be passed to a script. The command line argument can be any text that is used in the script. For example, a file name can be passed and used to create a map. Enter the following to run a script with a command line argument:

 

<Scripter path> -x filename.bas command

 

where command represents the commands that should be passed to the script. Access the command line argument from the script using the Command$ option. For example, if the script name is variable.bas and it can be run with any grid file, you could use:

 

"c:\program files\golden software\Surfer 13\scripter\scripter.exe" -x "c:\temp\variable.bas c:\temp\sample.grd

 

Do not quote the arguments in the command. To use the data in the script, use:

 

'Return the argument to the Immediate window

Debug.Print Command$

 

'Create a contour map from the grid

Plot1.Shapes.AddContourMap(GridFileName:=Command$)

 

 

See Also

Running Scripts

Introducing Scripter

Writing Scripts

Scripter BASIC Language