<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. 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.
The Scripts Module Allows:
On this page:
The Scripts Module manages and executes user-defined scripts for automation and process control.
ScriptTaskDefines code that executes in reaction to an event (trigger) or periodically at specified intervals. |
ScriptClassA library of functions and methods that can be used in Script Tasks, Expressions, or from the Code Behind on graphical Displays. |
ScriptExpressionOne line of code in response to an event, where the entire script isn't necessary. |
Script ReferencesExternal DLLs included for a script or display code compilation. |
Module Highlights
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 on the execution of the Tasks and Expressions define on 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 solution are prorating User Interfaces that are Portable, meaning the exact same drawing and display configuration can run both as a WPF Windows RichClient, or as Web HTML5 page inside a browser. If you intend to run the graphical interface only on Windows, it is possible to enable in Solution → Settings to allow Tasks and Expressions running on the Client side.
For complex solutions or very large solutions, it's useful to get a deeper understanding of the Module execution process, see Scripts Module Execution if that is your case.
The Scripts module may encounter some issues in its operation. Here are some common issues and their troubleshooting:
Build Errors and Warnings: Make sure to check the 'BuildStatus' and 'BuildErrors' tabs to identify and address errors and warnings that arise during the build.
Code Language: If you change the code language in the code editor, confirm that the code has been correctly converted to the selected language.
Build Order: Ensure that the build order of the classes is set up correctly to avoid circular dependencies or initialization issues.
Domain Selection: Ensure that the domain is selected correctly (Client or Server) based on the needs of your project.
Expression Syntax: Check the syntax of the expressions, ensuring they comply with VB.Net or C# standards.
Execution Settings: Ensure that the execution settings are correct, so that the expressions are executed as expected.
Reference Issues: Make sure that all external references are configured correctly and that there are no compatibility issues or conflicts. Code Editor
Syntax Errors: Check for syntax errors in the code. Use the 'Auto Format' feature to identify potential issues.
Incremental Compilation Issues: Monitor the incremental compilation process to identify and resolve potential issues that may arise.
Debugger Setup: Ensure that the debugger setup is correct to allow effective code debugging.
Breakpoints and Watch Variables: Use breakpoints and watch variables effectively to identify and resolve issues.
Best Practices and Recommendations
Tasks:
Classes:
Expressions:
External Libraries:
The Script Namespace 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 |
| Integer | Number of times the Script Task <Task1> was executed. |
| TimeSpan | The Amount of CPU used the last time the Script Task Task1 was executed. |
ModuleScript properties | ||
---|---|---|
Property | Type | Description |
| Boolean | Flag indicating if the module Dataset has started. |
| String | Message OK or error when initiating the module. |
→ Read more about Objects and Namespaces.
→ Check the Script Examples and Solution Examples pages for some scripting examples.
In this section: