ExecuteScript (Application)

Description

Executes a script file. This routine allows a single plug-in to be written with more than one language. For example, a VBScript script could call a helper function written in JScript. It is also a useful way for a COM C++ plug-in to execute script code.

Alternatively, you can register the script as a custom command. One advantage of that approach is that the calling script does not need to know the full path to the called script.

If there is an error the global ErrorInfo contains detailed information, For example, if there was a parsing error or script error the details of what went wrong are recorded in the ErrorInfo.Description property and the line number is recorded in the ErrorInfo.HelpContext property. How you can extract this information depends on the language; for example, see 'GetErrorInfo()' in C++, 'err' in VBScript, and 'Error object' in JScript.

Scripting Syntax

Application.ExecuteScript( FileName, [Language], [ProcName], [Params] )

C# Syntax

Object Application.ExecuteScript( String in_FileName, String in_LanguageProgID, String in_ProcName, Object& io_Params );

Parameters

Parameter

Type

Description

FileName

String or Expression

Full path to the script file

Language

String or Expression

Language used to author the script.

Default Value: Determined based on filename extension.

Possible Values:

VBScript: VBScript language (the only recognized filename extension is '.vbs')

JScript: JScript language (the only recognized filename extension is '.js')

Python: Python ActiveX scripting language (the only recognized filename extensions are '.py' and '.pys')

PythonScript: Python ActiveX scripting language (the only recognized filename extensions are '.py' and '.pys')

PerlScript: Perl scripting language (the only recognized filename extensions are '.pl' and '.pls')

ProcName

String

Name of subroutine to execute. By the nature of scripting languages, any global code (code that is not part of a subroutine) is also executed.

Tip: In VBScript subroutines are called "sub" or "function", in JScript "function", in PerlScript "sub", and in Python "def".

Params

Array of Variants

Arguments to pass to subroutine

Return Value

A Variant containing the return value of the procedure

See Also

XSIApplication.ExecuteScriptCommand

Application.ExecuteScriptCode

Examples

• See Application.ExecuteScript.1.vbs



Autodesk Softimage 2011