Tools
The Tools menu includes the following options:
-
Backup scripts: Back up all scripts in a *.gz file.
NOTE: Script backup does not include user libraries; those must be backed up separately. -
Restore scripts: Restore a script from an archive (*.gz) file with two possibilities:
-
Remove existing scripts and import from backup.
-
Append, keeping existing scripts.
-
-
Print script listings: Shows all scripts with codes in a list format, sorted by categories.
-
Edit custom JavaScript: Insert JavaScript code for script control.
-
Show logs window: All log data is listed here; it is a duplicated window from Configuration → Logs. It allows debugging a script while simultaneously checking the logged data.
Example: Sample code for 1-Byte Object 1/0/0 controlling navigation between pages
$(function(){
/* Create an event listener on 1/0/0 to jump to the page with the object value */
const addr = Scada.encodeGroupAddress('1/0/0');
objectStore.addListener(addr, function(obj, type) {
/* To avoid execution on the opening page */
if (type === 'init') {
return;
}
/* Jump to the page with the object value */
if (currentPlanId !== obj.value) {
showPlan(obj.value);
/* Write the object back to 0 */
setObjectValue({ address: '1/0/0', rawdatatype: 5 }, 0, 'text');
}
});
});