You can use xsibatch to execute a script:
xsibatch -processing -script %TEMP%\test.js
The -processing flag tells xsibatch to run without a license (you can do this for anything that does not involve rendering).
The -script flag specifies the full path the script file.
If the script file contains functions, you can specify the name of the function to execute with the -main flag. For example, if the .js file contained a function named “test”:
xsibatch -processing -script %TEMP%\test1.js -main test
If the main function takes arguments, you can specify them with the -args flag. For example, if the function is defined like this (in JScript)
function test( sPath, sList, nValue )
{
// [body]
}
then you would specify the arguments like this on the xsibatch command line:
-args -sPath "%TEMP%" -sList "X,Y,Z" -nValue 22
Putting it all together, the xsibatch command line would look like this:
xsibatch -processing -script %TEMP%\test1.js -main test -args -sPath "%TEMP%" -sList "X,Y,Z" -nValue 22
Argument values are passed in as strings, and any quotation marks are stripped off.
Here’s a simple example of a test.js:
function test( sPath, sList, nValue )
{
LogMessage( sPath );
LogMessage( sList );
LogMessage( nValue );
LogMessage( typeof(nValue) );
}
The xsibatch command:
xsibatch -processing -script %TEMP%\test1.js -main test -args -sPath "%TEMP%" -sList "X,Y,Z" -nValue 22
And the output:
=======================================================
Autodesk Softimage 9.5.184.0
=======================================================
License information: using [Processing]
COMMAND: -processing -script C:\Users\blairs\AppData\Local\Temp\test.js -main test -args -sPath "C:\Users\blairs\AppData\Local\Temp" -sList "X,Y,Z" -nValue 22
// INFO : C:\Users\blairs\AppData\Local\Temp
// INFO : X,Y,Z
// INFO : 22
// INFO : string