Canvas also includes an easy-to-use feature that allows the user to create lists of actions to be completed without the use of scripting. These action lists can be tied to the change in a tag value, opening and closing the page, and other actions, similar to a script.
In the Command Editor, there are two command types:
Global Commands: This command type can be created using the Script Editor or Command Editor in the Action property for an object, and can be used by any object in the project.
Local Commands: This command type can only be created using the Command Editor for an object Action property and can only be used by the object where the command is being created.
Global Commands
Method #1
Click Tools > Script Editor… > click + icon > Create New Commands > + Add New Command.
Method #2
Click an object > Action tab > click Action drop-down menu > select Create New Commands. In the Command Editor, click Local Commands drop-down > select Global Commands > click + Add New Command.
Local Commands
Click an object > Action tab > click Action drop-down menu > select Create New Commands. In the Command Editor, click Local Commands drop-down > select Global Commands > click + Add New Command.
In the Command Editor and Script Editor window, the user can choose from a list of actions, and create a series of actions to be executed.
Commands | Functions | Description |
---|---|---|
Open Page | page.open("Page Name"); | Opens the selected page. Users can select the page by name or by its unique index. |
Close Page | page.close("Page Name"); | Closes the selected page. Users can select the page by name or by its unique index. |
Set Tag Value | tag.write("Tag Name"); | Sets the selected tag to a specified value. Users can select a constant value to write to the tag, or write another tag’s value to the selected tag. |
Toggle Tag Value | tag.write(“Tag Name”, !tag.read(“Tag Name”)); | Toggles the selected tags' value between 1 and 0. |
Enter Tag Value | keyboard.launchKeypad("ANA", { "header": "Header Title", "subheader": "Subheader Title", "x": 0, "y": 0, "min": 0.0, "max": 100.0, "format": "H,HHH" }); | Open a pop-up keyboard that allows the user to enter a value to be written to the selected tag. Users can write numeric or string values to a tag, though the tag must be the correct type to support the entered data. Ex: The tag must be a ‘STRING’ type for a text entry. Lines 1-3: Launch keypad requesting for a user input that will be stored to the “ANA” tag. Keypad will have a header and subheader title if assigned. Lines 4-5: Set the location for the keypad on the Xpanel screen. Lines 6-7: Set the minimum and maximum values a user can enter. Line 8: The value entered will appear in a chosen format. “H,HHH” is for the hexadecimal formatting, and “#,###” is for the decimal formatting. |
Call Script | system.importScript("Script Name"); system.runScript("Script Name"); | Runs the selected script. If the “Run on separate thread” options is selected, the script will be run on a separate thread ( Leave the “Run on separate thread” option unchecked if you want scripts to execute in the specified order. Line 1: When the box is unchecked, the selected script will run in the current thread. This will pause the calling script until the imported scripts has completed. The order of execution is guaranteed. Line 2: When the box is checked, the selected script will run in a new thread. This will not interrupt the operation of currently running scripts. The order of execution is not guaranteed. |
Enable/Disable Schedule | schedule.setEnable("Schedule Name", true); schedule.setEnable("Schedule Name", false); | Enables or disables the selected runtime schedule. Line 1: Enabled the selected schedule. Line 2: Disables the selected schedule. |
Save Alarm CSV | alarm.createAllCsv(Storage.Local); alarm.createCsv("Group A", Storage.Local); | Saves a log of all alarm events to a CSV. Users can select to save the file locally on the Xpanel, to a USB, or to an SD card. You may choose where the CSV will be stored to: Local (on the device’s hard drive), USB, or SD Card. The default CSV locations are as follows: Users can also delegate a specific alarm label to be saved in the CSV, in which case all other labels will not be included in the CSV. Line 1: Saves a CSV for all alarm labels. Line 2: Saves a CSV for alarms that have the specified label. |
Save Data Log CSV | datalog.createCsv("Data Logger Name", Storage.Local); | Saves the selected Data Log to a CSV file. You may choose where the CSV will be stored to: Local (on the device’s hard drive), USB, or SD Card. The default CSV locations are as follows: You may also choose how far back in time the CSV should cover. Options include (All, Past Hour, Past Day, Past Week, Past Month, and Past Year). |
Start/Stop Data Log | datalog.start("Data Logger Name"); datalog.stop("Data Logger Name"); | Starts or stops a data log model. This function does not directly create an entry into the log; it only enables entries to be added via other triggers. Line 1: Start the Data Logging actions Line 1: Stop the Data Loggers action |
Add Row to Data Log | datalog.addRow("Data Logger Name"); | Adds a new entry to the Data Log. |
Open Login Window | system.openLoginWindow(); | Opens the built-in IAM login window. |
Logout User | system.logout(); | Logs out the current user from the IAM system. |
Press Key | keyboard.sendKeyEvent(0x01000004); | Enters the user specified keystroke. Function codes are used to enter specific key strokes, those key codes can be found at the following link: |
Send Screen Notification | notification.send("Welcome to CIMON!"); | In the runtime, notification window will appear on the Xpanel screen. |
Exit Project | system.exit(); | Exits the project and canvas runtime. |
Open Config Menu | system.openConfig(); | Opens the Xpanel Settings menu. |
Set Translation Language | system.setLanguage("English"); | Sets the language according to the one specified in the Action List. |