TSL Automation Solutions Logo

Section 15.3.1 · Chapter 15: Using Macros

Native Script Editor Window

The native script editor is a text-based editor with syntax coloring and line numbering. Line numbering in the left margin of the page helps you refer to the specific position of the native script. Syntax coloring gives you visual cues about the structure by using different colors for various elements, such as keywords in black, comments in green, addresses in blue and constants in red.

■ Editing Native Script
With the native script editor, you can cut, copy, and paste selected text using menu commands, key combinations or drag-and-drop operations. You can also undo and redo selected editing actions.
You can right-click to display a pop-up menu of editing commands. The editing commands available depend on what the pointer is pointing to.

The native script editor allows the following editing actions:
* Cutting, copying, pasting, and deleting selection of lines, multiple lines or text
* Undoing and redoing editing actions
* Using drag-and-drop editing to move or copy a selection of text within one native script editor window, or between native script editor windows.

The following table shows the supported editing commands.

Menu Command Key Combination Description
Cut CTRL+X Removes selected text from the active native script editor window.
Copy CTRL+C Duplicates selected text in the active native script editor window.
Paste CTRL+V Pastes cut or copied text into an active native script editor window.
DELETE Deletes text without copying it to the Clipboard.
Undo CTRL+Z Reverses the last editing action.
Redo CTRL+Y Reapplies the prior editing that has been undone.
CTRL+A Selects all texts in the active native script editor

Note that all editing commands require a selection in order to work. Some commands can make a selection based on the current cursor location.

■ Using Comments in Native Scripts
Comments are notes to be ignored when running the native script commands. Native script supports both single-line comments and block comments. Single-line comments begin with two forward slashes (//) and run to the end of the line.
The following is an example of a macro command followed by a single-line comment.
IF $U0.0 (B) // Key Down

Block comments begin with an opening delimiter (/*) and run to a closing delimiter (*/). Comments do not nest.
The following is an example of a block comment.
/* $N1001=WH2021
$N1010=$N1001 */

■ Specifying Constants in Native Scripts
To specify a hexadecimal number, use either the h or H suffix. For example, 12abH and 3ABh are valid hexadecimal numbers. You can also use either the “0x” or “0X” prefix. For example, 0x1278abc and 0XFFFF0000 are valid hexadecimal numbers.

To specify a binary number, use either the b or B suffix. For example, 001100111b and 11110000B are valid binary numbers.

For decimal numbers, in most cases, you just type the numbers as they are to specify the constants. However, ambiguity exists when a constant is the same as a valid external variable. For example, if a panel application has a link to a Modicon ModBus slave device, it is impossible to tell whether the number 40001 is a constant or a word address of the controller. To avoid this kind of ambiguity, use the following methods to explicitly declare that a number is a constant:

1) Use K, k, D, or d suffix for an integer number. For example, -123K and -123d are valid specifications of constant -123.
2) Use either the f or F suffix for a decimal number with decimal point. For example, -12.3F and -12.3f are valid specifications of constant -12.3.

Need PM Designer itself?

V4 for current PK, PT, ITV and PM panels, V2 for older models. Free, sent by email.

Source.Section 15.3.1 of the PM Designer Software User Manual, Edition 2.0, © Cermate Technologies Inc. (www.cermate.com, service@cermate.com). Reproduced online, with the manual's own figures, by TSL Automation Solutions, authorised Cermate distributor, for users of Cermate HMI panels. PM Designer and PanelMaster are trademarks of Cermate Technologies Inc.

Text and figures are the manufacturer's and may describe features your panel or software version does not have. For a plain-language introduction read the PM Designer guide; for help with a specific panel contact TSL Automation.