The Scripting API provides a flexible way to write scripts that can interact with Pulsonix. The Legacy Scripting system is now deprecated and will be removed in the future, so new scripts should be written using the Scripting API.

This page provides a guide on rewriting Legacy Scripting scripts to work with the Pulsonix Python client for the Scripting API.

Exercise caution when porting Legacy Scripts - some functions may be callable in the same way, but have slightly different behaviours.

The Examples folder installed with the application contains upgraded versions of many example Legacy Scripts, including ones which have been translated from Visual Basic Script and JavaScript.

Python scripts

Legacy Python scripts will require some modification to work with the Scripting API, but much of it can be guided by warnings from your development environment and errors from the Python interpreter.

Python version

The generated client supports Python 3.10+ and the Legacy Scripting supports Python 2.7. Some language changes between versions may need to be addressed for your scripts.

Function access

Because Pulsonix no longer hosts scripts, the pulsonix package must be imported in a script for API functionality to be accessible. To make upgrading easier, the contents of the Pulsonix package can be made global by using from pulsonix import *.

Class reference changes

Various functions, classes and parameters have had their name or functionality changed, but most can still be used in the same way as before. All classes, methods and properties are named in “CamelCase”, and enumerations and their values are named in “snake\_case”. Notable changes to function behaviour and signatures include:

  • DesignItem.Name no longer exists and is instead implemented by some sub-classes. Scripts can still attempt to access the Name property of any design item and items which are not named will raise the appropriate exception. This change makes it easier to track down invalid property accesses.
  • Many Application unit functions have been reworked, making unit conversions and formatting easier.
  • Component no longer provides methods which automatically access the component’s first SymbolInstance. This change, combined with new class method and properties, gives finer control over components with multiple gates.

Refer to the Scripting Reference for detailed information function and property usage.

Utility functions

The Scripting API no longer contains functions for generic operating system access. You should instead use built-in Python functions (print, input, open, etc.) and modules (tkinter, sys, os, subprocess, etc.).

Error handling

The Python client has an exception based approach to errors. Some error checking code will have to be changed to use try blocks instead of checking for null values.

Scripts in other languages

Other client implementations are not provided with Pulsonix, so scripts in other languages must use a custom client or be translated to use the Pulsonix Python client.

Scripting overview | Getting started with Python scripting | Python Scripting FAQ