Configuring the Predefined Scripts of a Graphic
- Last UpdatedJul 13, 2023
- 2 minute read
You can configure the predefined scripts of a graphic. The predefined scripts can consist of:
-
A script that runs one time when the graphic opens (On Show).
-
A script that runs periodically as long as the graphic is open (While Showing).
-
A script that runs one time when the graphic closes (On Hide).
Note: The Predefined Scripts animation cannot be deleted. It can contain scripts for each trigger type On Show, While Showing and On Hide.
To configure the predefined scripts for a graphic
-
Open the graphic in the Industrial Graphic Editor.
-
On the Special menu, click Scripts. The Edit Scripts dialog box appears.
-
In the Trigger Type list, click:
-
On Show to configure a script that runs one time when the graphic opens.
If you create an OnShow script that uses a custom property bound to a tag, there is no guarantee that the tag data is valid when the script runs. This could occur because of the asynchronous nature of data subscriptions in HMI/SCADA software. Your script should first test the quality and status of the tag value before it is used in the rest of the script.
When the On Show trigger type is selected, the field that appears to the right of the Type list becomes a Data Timeout field. For more information about using this field, see Ensuring Proper OnShow Script Execution.
Note: If you create an OnShow script that uses a custom property bound to a tag, there is no guarantee that the tag data is valid when the script runs. This is because of the asynchronous nature of the data subscriptions. Your script should first test the quality and status of the tag value before it is used in the rest of the script.
-
While Showing to configure a script that runs periodically while the graphic is open.
-
On Hide to configure a script that runs one time when the graphic closes.
-
-
If you configured a While Showing script, type a time period in milliseconds in the Period box. This specifies after how many milliseconds the action script is executed.
Note: If you set the While Showing period too low, system performance may decrease.
-
Type your script in the main edit box.
Note: If the graphic includes a custom property, the name of the custom property and a nested class property in the script cannot be the same.
-
Select external data using your HMI's browser or explorer.
-
When you are done, click OK. The script editor checks the syntax of the script and may inform you of invalid syntax. Click:
-
Yes to save changes even if the script contains errors.
-
No to cancel the changes and close the script dialog box.
-