Softimage SDK Programmer's Guide > Plug-in Development > Issues in Batch Scripting >

# Passing Arguments to Batch Scripts

In batch mode, scripts cannot require any interactive input such as prompting for a file or path — this does not include property editors that open automatically as you work in the interface. For example, the following code would generate an error if it is run in batch mode. This is because the OpenScene command, when invoked without any arguments, displays a dialog box that prompts for a scene to import.

    sub MyBatchScript()
    	OpenScene	' error
    end sub

    ' Main
    MyBatchScript

There are two ways to deal with this. The first way is to explicitly provide all arguments in the script. For example:

    OpenScene "C:\MyProject\MyScene.scn", false

In this case, the false argument is a flag that indicates that there should be no prompt to save changes to the current scene. There is a similar flag for DeleteAll.

The other way is to declare any necessary parameters as arguments in a procedure declaration and then pass them on the command line when the script is run in batch mode. For example, in VBScript you would declare the arguments for a procedure as follows:

    Sub myproc(myargname1, myargname2)
    	...
    End Sub

At a command prompt, you would then run the script as shown below:

    xsi -script myscriptfile.vbs -main myproc -args -myargname1 myargvalue1 -myargname2 myargvalue2