Skip to main content

Execution in Script Editor

Overview

Next Design's Script Editor allows you to directly write and immediately execute C# and Python scripts.

Because you can execute scripts without writing a manifest, it's convenient for experimenting while editing handler implementation code or executing ad-hoc processes.

How to Use

To execute a script in the Script Editor, follow these steps:

Script Editor

  1. Click [View] > [Pane] > [Script] on the ribbon to display the Script Editor.

  2. Switch the language you're using by selecting "CSharp" or "Python" from the [New] dropdown on the ribbon. IntelliSense and syntax highlighting will be enabled according to the selected language.

  3. Either write the script directly in the script editor, or copy the script to the clipboard and paste it by pressing Ctrl+V.

  4. Click [Run Script] on the ribbon to execute the script.

Example Script

Running the following script in the script editor will display the project name in a confirmation dialog.

var project = App.Workspace.CurrentProject;
if (project == null)
{
UI.ShowInformationDialog(
"Please open the project file before running.",
"script"
);
return;
}
UI.ShowInformationDialog(
"Project Name: " + project.Name,
"script"
);

IntelliSense Constraints

The script editor allows you to use IntelliSense, which displays completion suggestions for members and keywords as you type code. However, the following limitations apply:

C# Script

  • Host variables implicitly available in the script editor (e.g., App, UI) may not appear in completion suggestions.

  • Functions defined at the top level within a script will not appear in completion suggestions.

  • Comment snippet completion does not work for functions defined at the top level within a script.

Python Script

  • Entering . for a loop variable in a for loop will not display member completion suggestions.

  • Members declared in the base class (the class from which a class is inherited) will not appear in completion suggestions.

  • Comment snippet completion is not supported.

External modules in folders added to the module search path using sys.path.append() will not be included in the autocompletion suggestions.