Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ InTouch HMI

Add a UDT script

  • Last UpdatedJul 15, 2026
  • 6 minute read
  1. In the User defined type pane, right-click the data type, select New from the context menu, and then select Script.

    Create Script Option

    OR

    Select Add scriptScript Icon on the toolbar.

    OR

    Use the shortcut key Ctrl+Shift+R.

    A new script, Script001, is created and opened in the script editor. To rename the script, right-click the script and select Rename. In the below example, the script is renamed to UpdateSetpoint.

    Add scrip

    The default signature of this script method is created. The following illustrates the default signature of a C# script.

    The following illustrates the default signature of a Python script.

    Python Default

    The method name must match with the script name. If it doesn’t match, an error message will appear. For example, if a script named "UpdateSetpoint" does not include a public method called "UpdateSetpoint", the following message will be displayed.

  2. On the Properties grid you can view the properties of the selected script. It includes:

    • Name: Name of the script.

    • Comment: Any comment if you want type.

    • Language: Select the language in which you want to write the script. When creating a script for the first time by default, C# is selected. If you want to use Python script, then, you should change it to Python manually. When creating a new script, the previously selected script language is retained. For example, if you create and save a script in Python, any new script will default to Python. To use C#, you must manually change the script language.

      Note: You cannot change the script language after you start typing a script. To select a different language, delete the existing script content or create a new script.

      Example:

      Properties Example

      Note: If 32-bit Python is not installed on your machine, and you select it as the language, an error message will appear prompting you to install Python to enable the functionality. For installation steps of Python, see Install Python.

  3. Type the script in the language that you have selected in the Properties grid. Use the toolbar options to perform different editing actions. You can use native InTouch tag as well in UDT script. Use the following syntax:

    • For Standalone InTouch application:

      <udtinstanceName>.<udtmembers>\ me.<udtmembers>\ <InTouch Tags>;

      OR

      InTouch.<udtinstanceName>.<udtmembers> \ InTouch.me.<udtmembers>\ <InTouch Tags>;

      Example:

      • Furnace_1.TemperatureSetPoint = Furnace_1.TemperatureSetPoint + 5;

      • me.TemperatureSetPoint = me.TemperatureSetPoint + 5;

    • For Managed InTouch application:

      InTouch.<udtinstanceName>.<udtmembers> \ InTouch.me.<members>\ <InTouch Tags>;

      Example:

      • InTouch.Furnace_1.TemperatureSetPoint = InTouch.Furnace_1.TemperatureSetPoint + 5;

      • InTouch.me.TemperatureSetPoint = InTouch.me.TemperatureSetPoint + 5;

  4. Use the validate validate icon to validate the script.

    If there is any error, it will be displayed in the Error list section present at the bottom of the script editor.

  5. Fix the error if any and then select Save icon on the tool bar.

    Note: UDT script files are stored in the scripts folder under the application folder.

Important information

  • When referencing a namespace (for example, InTouch or Galaxy), use dot notation (.) instead of the colon (:). Colon-based references are not supported in C# and Python.

  • There is no debugging support for Python UDT scripts. In addition, reference validation for Python scripts is performed only at runtime. As a result, the script editor does not indicate whether a referenced object or namespace exists while you are editing or saving the script. Invalid or missing references are detected only when the script executes at runtime, and the editor will not warn you about such issues during script authoring.

  • A maximum of six nested UDT levels is allowed. For example, "Datatype1.Datatype2.Datatype3.Datatype4.Datatype5.Datatype6.String1". For more information see UDT specification.

  • UDT Real data type member is internally saved as Float data type.

Toolbar options

Option

Name

Description

Save

Saves the script

Undo icon

Undo

Undoes the previous action performed in the script editor.

Redo icon

Redo

Redoes the undo action the script editor.

Select all

Select all

Selects all the text

Cut icon

Cut

Cuts the selected text

Copy icon

Copy

Copies the selected text

Paste icon

Paste

Pastes the copied text

search icon

Search

Finds text in the document

Replace icon

Replace

Replaces the text with the specified text. Select the Replace icon. In the Find what field type the text that you want to be replaced. In the Replace with field type the text that want to be replaced with.

Go to icon

Go to

Lets you jump to a specific line

zoom icon

Zoom in Zoom out

Zooms in to get a close-up view of the text.

Zooms out to see more of the page in reduced size.

Multiple script tab support

  • Users can create and launch scripts within individual tabs, allowing multiple scripts to be managed simultaneously without losing data or context when navigating between tabs.

  • Switching between script tabs preserves the current state and context of each script, ensuring no information is lost during navigation.

  • Each tab displays IRT (Information Resource Tree) and tool tip details, providing users with relevant information for the selected script.

  • When launching a script from a derived or member template at the register level, the script opens from its parent template, maintaining the origin context.

  • Closing a script tab highlights the previously active script in the treeview, and its properties are displayed for easy reference.

Examples

The following scripts update the TemperatureSetPoint of the current object by adding a given value to it. For example, if the current setpoint is 100 and you pass 3, the new setpoint becomes 103.

Script using C#

public async Task UpdateSetPoint1(float value)

{

me.TemperaturesetPoint = me.TemperaturesetPoint + value;

}

C# example

Script using Python

def UpdateSetPoint(value):

me.TemperaturesetPoint = me.TemperaturesetPoint + value

Python example

In both the scripts,

  • InTouch.me is a relative reference, TemperatureSetPoint a member of the UDT.

    What happens here:

    • Reads the current TemperatureSetPoint

    • Adds value to it

    • Writes the updated result back to TemperatureSetPoint

  • Value is a custom property of float type. Configure an animation to update the above "Value". If Value = 10 then executing the script increments the TemperatureSetPoint by 10.

In This Topic
Related Links