Creating & Storing Scripts in Altium NEXUS

Now reading version 3.1. For the latest, read: Creating & Storing Scripts in Altium NEXUS for version 5

This documentation page references Altium NEXUS/NEXUS Client (part of the deployed NEXUS solution), which has been discontinued. All your PCB design, data management and collaboration needs can now be delivered by Altium Designer and a connected Altium 365 Workspace. Check out the FAQs page for more information.

 

Altium NEXUS scripts are usually created and stored in a Script Project (*.PrjScr), but can be added to or stored in any type of project.

To begin writing scripts, start by creating a new script project and adding script files to that project.

Creating Script Projects and Scripts

A Script Project helps you manage your scripts, and can be created by selecting File » New » Project » Script Project from the main menus.

A new project (Script_Project1.PrjScr) to store scripts will be listed in the Projects panel.

To add a new script to the project, right click on the project name and select Add New to Project from the context menu.

With a new script project established, add a new script to the project.
With a new script project established, add a new script to the project.

Use File » Save Project As to save the project as the desired name. Similarly, use File » Save As to save and rename the new script.

When creating a new script, there are two script types to choose from depending on your project requirements – Script Units and Script Forms.

Script Types

Script Units

A script unit is a script document with specific language syntax, for example DelphiScript.

A Script Unit with script code.
A Script Unit with script code.

Script Forms

A Script Form is a window that can host a range of controls such as buttons, memos and list boxes that can have event handlers. In the editor, a Script Form has two views that are selectable with the Code and Form tabs, as can be seen at the bottom of the script document shown below.

A Script Form with a Code and a Form tab opened.A Script Form with a Code and a Form tab opened.

Script relationships within a Project

When multiple scripts are in a project, any script (using the same language set) within that project has access to global variables and procedures. All scripts in a project are 'visible' in effect, so a procedure in one script can call another procedure in different script within the same script project.

It is important to have unique procedure and global variable names for scripts within the same project. One approach is to move all the common procedures/functions that are used in different scripts to one new script within the same project. This allows the procedures and functions in this new common script to be reused easily for different script projects.

► Refer to Writing Scripts for an example of calling a procedure from another script.

Global Projects

Script projects can be installed using the Global Projects feature so that they are preloaded and available when the software starts. The global variables and procedures from these scripts are available for use in other open script projects.

To make a script project global, navigate to the Scripting System - Global Projects page via the Preferences dialog, accessed by clicking on the control button at the top-right of the workspace. Use the Install button to navigate to and select a project from the file or server. Repeat this process for all script projects that you would like to make globally available.

Use the Scripting System – Global Projects from the Preferences dialog to install scripts.
Use the Scripting System – Global Projects from the Preferences dialog to install scripts.

Global Projects allow scripts from a local project of the same type to use routines from the installed global script projects. When the Select item to Run dialog is launched (File » Run Script), the installed script projects will appear along with other script projects currently open in the Projects panel.

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.
콘텐츠