Extend solutions with Python, C# and VB.NET logic.
Reference → Scripts| Tutorial | How-to Guide | Reference
Scripts Module (Reference) provides automation and business logic capabilities through classes, tasks, expressions, and integrated development tools. It enables:
Scripts execute primarily server-side for web compatibility, with optional client-side execution for WPF-only deployments.
Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Section | Path | Purpose |
---|---|---|
Classes | Scripts → Classes | Reusable methods and functions |
Tasks | Scripts → Tasks | Event-driven automation logic |
Expressions | Scripts → Expressions | Simple calculations and method calls |
References | Scripts → References | External DLL integration |
Code Editor | Scripts → Code Editor | Integrated development environment |
Action | Where | Purpose |
---|---|---|
Create Classes | Scripts → Classes | Build reusable function libraries |
Define Tasks | Scripts → Tasks | Implement automation logic |
Add Expressions | Scripts → Expressions | Configure simple calculations |
Import References | Scripts → References | Add external assemblies |
Edit Code | Scripts → Code Editor | Write and debug scripts |
Default Configuration:
Web Compatibility:
Access script objects at runtime:
csharp
// Access Script Classes
var result = @Script.Class.ClassName.Method();
// Monitor Script Tasks
int count = @Script.Task.TaskName.ExecutionCount;
TimeSpan cpu = @Script.Task.TaskName.LastCPUTime;
For complex or large solutions requiring optimization: → See [Script Engine (Reference)] for deep technical details
→ [Script Classes (Reference)]
→ [Script Tasks (Reference)]
→ [Script Expressions (Reference)]
→ [Script References (Reference)]
→ [Code Editor (Reference)]
Build Errors:
Circular Dependencies:
Tasks Not Running:
Performance Issues:
DLL Not Loading:
Namespace Conflicts:
Breakpoints Not Hit:
Variable Inspection:
Excerpt Include | ||||||
---|---|---|---|---|---|---|
|
Page Tree | ||
---|---|---|
|
HTML |
---|
<style>
.text-span-6 {
background-image: linear-gradient(99deg, rgba(170, 163, 239, .5), rgba(125, 203, 207, .5));
border-radius: 50px;
padding-left: 15px;
padding-right: 15px;
}
#title-text {
display: none;
}
.panelgradient {
background-image: linear-gradient(180deg, #d5def0, whitesmoke);
border-radius: 8px;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 4rem;
display: flex;
position: relative;
}
</style>
<div class ="panelgradient">
<h1 style="text-align: center;">Scripts <br> (Tasks and Classes)</h1>
</div> |
The Scripts Module supports multiple programming languages, including C#, VB.NET, Python, and JavaScript, enabling the creation of high-performance server-side and client-side scripts in Display Code-Behind. Its built-in code editor streamlines development with automated translation between C# and VB.NET and provides access to all .NET Framework classes available in Visual Studio. The module simplifies distributed application development using server or client domains and ensures high performance through custom code compilation. Additionally, it enhances graphical displays with Display Code-Behind functions and offers debugging tools for quick identification and resolution of coding issues.
On this page:
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
The Scripts Module allows:
The Scripts Module manages and executes user-defined scripts for automation and process control.
Defines code that executes in reaction to an event (trigger) or periodically at specified intervals.
A library of functions and methods that can be used in Script Tasks, Expressions, or from the Code Behind on graphical Displays.
One line of code in response to an event, when the entire script isn't necessary.
External DLLs included for a script or display code compilation.
Module Highlights
Built-in Code Editor: Our code editor supports C#, VB.NET, JavaScript, and Python languages.
Server and Client Domains: Create scripts that execute on the server for global reach or on the client side for local reach.
Events and Scheduling: Tasks and expressions can be triggered by date, time, condition, calendar, tag change, or interval. Execution is distributed among processes, each running in its own application domain, isolated from the real-time database, ensuring maximum system security and performance.
Object Orientation and Solution Object: All solution objects, including tags, datasets, alarms, devices, and communication statuses, are immediately accessible via IntelliSense as native .NET objects. No temporary tags or function calls are required. With a single command, move data from tags to .NET objects and external data tables.
Configure Your Python Interpreter: The Scripts Module delivers exceptional scripting capabilities across various programming languages with seamless integration of Python. You can configure any version of the Python interpreter for each project.
Scripts Module configuration workflow
Action
Where
Comments
Manage ScriptClasses
Scripts / Classes
Create or Import you function Library. Learn more at Scripts Classes.
Manage ScriptTasks
Scripts / Tasks
Create or Import Tasks. Learn more at Scripts Tasks.
Manage ScriptExpressions
Scripts / Expressions
For simple event or time driven actions, use Expressions. Learn more at Scripts Expressions.
Manage Script References
Scripts / References.
If you code required their party libraries, include the references. Learn more at Scripts References.
The key concept to be aware of regarding the execution of the tasks and expressions defined in the Script Module is that they execute on the server computer.
Only the CodeBehind of the displays is executed on each client computer. The script classes can be consumed by both server and client stations.
Current solutions are prioritizing user interfaces that are portable, meaning the exact same drawing and display configuration can run as a WPF Windows Rich Client or as a web HTML5 page inside a browser. If you intend to run the graphical interface only on WPF Windows and not on web pages, it is possible to enable this in Solution / Settings to allow tasks and expressions to run on the client side.
For complex solutions or very large solutions, it's useful to get a deeper understanding of the Module execution process. Read more at Module Script Execution if that is your case.
The Namespace Script is the entry point for all objects related to the Scripts module.
The Script.Class
object lists all configured tables and its runtime properties. The Script.Task
object lists all configured database connections and their runtime properties.
Examples:
Script Task Properties
Property
Type
Description
Script.Task.Task1.ExecutionCount
Integer
Number of times the Script Task <Task1> was executed.
Script.Task.Task1.LastCPUTime
TimeSpan
The Amount of CPU used the last time the Script Task Task1 was executed.
→ Read more about Objects and Namespaces.
The Scripts module may encounter some issues in its operation. Here are some common issues and their troubleshooting:
In this section: