• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Sequencer
  • Sequencer - RunScript

Sequencer - RunScript

The RunScript can be added to Basic Block Execution Control Chart (ECC) State blocks. and are intended to run short Chai scripts using local Argument and CDPPort values when the State becomes active.

The RunScript can also trigger sending a local Event when no script is set or the script calls emit(); function and the output is connected to an EventOut.

Note: When RunScript does not call emit(); function or is not connected to EventOut output, no event is emitted as a result of running a non empty script.

As an alternative the State blocks can also have run operation(s) that indicate what operators to execute when the state becomes the current state in ECC.

Note: With Basic Block TransitionMode property option P makes it also possible to run RunScript script when the ECC stays in the same state during the process run instead of only on transitioning to a State.

Properties

PropertyDescription
ScriptScript to execute, when the last statement evaluates to true any connected local event will be emitted. All Argument names, <state_name>.Time, <state_name>.Visited, <state_name>.Active, <port_name>.Connected and <port_name>.<api_name> can be used in the expression as immutable variables. See Expression Syntax for more details.
RoutingListList of routings to local events to emit when the scrips is empty or emit(); function is called in script.

Note: All the available unrouted variables in the expression, like Arguments and Port values, are mutable.

Note: Nested Port and Operator block outputs are inputs from RunScript's perspective and vice versa.

Note: All mutable block output values used in expressions must be cast to a primitive value using cast operator ArgumentOut = double(ArgumentOut) + 0.5;. Input values can be used directly without casting ArgumentOut = ArgumentIn + 0.5;

Note: All routed input and output Arguments and Port values will not be updatable by RunScript.

See Chai script for syntax help.

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top