Skip to main content

IApplication.ExecuteScriptCode(string,string,string,IScriptParams) Method

Namespace: NextDesign.Desktop

Description

Executes the given script code.

By specifying basePath, you can use relative paths for external files used within the script code.
If not specified, the project file path is used as the starting point for searching for external files, provided the currently open project is saved.

Argument

NameTypeDescription
codestringScript code
langstringScripting language
- "cs": C#
- "py": Python
basePathstringPath to which external files are searched (if null, the folder where the project file is stored)
scriptParamsIScriptParamsScript parameters

Return value

  • object

Exception

NameException classDescription
Invalid argumentExtensionArgumentExceptionWhen a string not corresponding to the scripting language is specified
Script execution failedExtensionScriptExceptionWhen script execution fails
(InnerException allows access to the exception that caused the failure)

Annotation

The script's return value is the result object of the script's return statement.
If the script does not contain a return statement, it will return null.