Script languages in the HMI project

Scripting languages enable the client-side extension of a TwinCAT HMI project with complex logics that cannot be mapped using the engineering functions. The scripting languages provide the developer with all options and functions of the respective scripting language. In addition, the scripting languages provide access to the framework API.

In addition to the JavaScript script language, version 1.12 makes the TypeScript programming language available for development purposes. TypeScript code is converted to JavaScript code by the TypeScript transpiler. TypeScript offers many advantages over JavaScript thanks to typification and the TypeScript syntax. This enables many errors to be detected at an early stage during development, making source code development easier and faster.

A distinction is made between three types of usage:

  1. Action: An action consists of JavaScript code that can only be used within the Actions and Conditions Editor.
    Application: Execution of simple JavaScript functionalities.
    Info: No TypeScript support.
  2. Functions: A function consists of TypeScript/JavaScript code and an associated description and is added separately to a project.
    Application: Execution of TypeScript/JavaScript in the Actions and Conditions Editor and in the Properties window.
  3. Code-Behind: Code-Behind consists of TypeScript/JavaScript code and is added to a project as a separate file.
    Application: Execution of complex TypeScript/JavaScript code.
Script languages in the HMI project 1:

JavaScript is supported from version 1.8, TypeScript from version 1.12.

See also

TypeScript documentation