Welcome to Scripts in WebAccess!
Scripts are simple programs used to customize your displays screens and SCADA system with user built calculations and logic. The most common use of scripts is advanced animation. Scripts in WebAccess are powerful enough to create reports, communicate with other programs and do control. Scripts are programmed in a computer languages similar to BASIC.
They are called scripts, because they are not compiled, the script programs are "interpreted", as soon as you save and download your source file, it is ready to run. The source file is in simple text format.
There are three scripting languages supported by WebAccess.
Tcl (pronounced as "tea sea el" or "tickle"). If you have any programming experience, you can be writing scripts in 30 minutes. Tcl is an industry standard taught in many schools. You can download Tcl programs and tutorials from the Internet. There are many examples in this WebAccess Engineering Manual also. There is a complete guide to Tcl in this Engineering manual. WebAccess client and SCADA node include the Tcl script engine (version 8.0). Tcl script will run on any client or SCADA node except those using Windows CE.
VB Script (pronounced as 'vee bee script') is provided for advanced users already familiar with VB Script used for many web sites. This the version of Visual Basic used on the world wide web and many web sites. This is well documented on the web. This engineering manual doe snt go into detail on VB Script commands and assumes the user is already familiar with VB Script. To interact with WebAccess tags and graphic displays, VB Script uses ACTION commands similar to those used with TCL. VB script uses the script engine installed as part of the Microsoft Operating system. VB Scripts should run on most all clients and SCADA nodes unless VB Script is disabled or not installed in the Microsoft Operating System. Windows CE is not supported by WebAccess scripts.
For more information on VB Script, please
visit:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriVBScript.asp
JScript (pronounced as
'jay script') is also
provided for advanced users already familiar with Java Script used
for many web sites. It is indirectly related to Java. This is
well documented on the web. This engineering manual doesn't
go into detail on J Script commands and assumes the user is already
familiar with JScript. To interact with WebAccess tags and graphic
displays, JScript uses ACTION
commands similar to those used with Tcl. JScript uses the
script engine installed as part of the Microsoft Operating system.
JScripts should run on most all clients and SCADA nodes unless J
Script is disabled or not installed in the Microsoft Operating
System. Windows CE is not supported by WebAccess scripts. For more
information on JScript, please visit:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsoriJScript.asp
There are two types of scripts:
· Local Scripts - also called Screen Scripts - run on a client.
· Global Scripts - run on the SCADA node.
Local Scripts (Screen Scripts)
Local Scripts run only run when the associated Screen is displayed or called by a Pushbutton on a Screen. Local Scripts are also referred to as Screen Scripts. Local Scripts run on the Client in either View (web browser) or ViewDAQ. Local scripts are downloaded to a web client when the display is called up. The script runs on the remote client independent of other clients. Local Scripts run at the frequency specified by the Graphic Parameters (Set Graph Param) as fast as every 25 milliseconds.
Local scripts are assigned to a graphic display with one of three options:
Run Once when display first opened.
Run continuously while display is open by user.
Run Once when display closed.
Local scripts can also be called by a Pushbutton a graphic display (<SCREXEC>) or called by another local script (SCREXEC).
A single local script can loop repeatedly in a client, regardless of the graphic display, using the <SCRLOOP> keymacro to SCRLOOP Action command.
Local Scripts (Screen Scripts) can be downloaded from the project node to the SCADA node using the download Graph Only command that can be performed without stopping the SCADA node.
Local scripts are downloaded to the Client from the SCADA node when the display using the script is opened. The Client will have to refresh the screen that uses a new version of Local Screen Script.
Local scripts are also downloaded to the client from the SCADA node when it is called by another script with the SCREXEC command.
Global Scripts (SCADA node Scripts)
Global System Scripts run on the SCADA Node, independent of any Display. Global Scripts can be configured to run in one of three modes:
Run Continuously at user specified frequency (as fast as 25 milliseconds).
Once at Start-up or Restart
Once at Shutdown (or restart).
Global Scripts can also be run by user command using the Global Script System Display. If it has been configured in GlobalScript Configuration page or specified in the SCADA script initialization file (BWSCRRDT.INI).
Global scripts can also be called by other global scripts.
Global scripts run a subset of ACTION commands. Most commands that interact with a display screen are ignored by SCADA scripts (for example, GOTO GRAPH, GOTO URL, POPUP a dialog box).
Global Scripts are usually written using the Script Editor in DRAW. The Global Script Configurator in SCADA Node properties, has a pull down list of files with the *.scr, *.js and *.vbs extensions in the node's \bgr subdirectory on the Project node.
Global Scripts are stored in the \bgr directory. The same script can be used as both a Global script and a Local script (note that not all commands are supported by Global scripts).
Global Scripts must be downloaded from the Project Node to the SCADA node using the Download or Graph Only command without stopping the SCADA node.
The Global Script configuration can also be downloaded to the SCADA node without stopping the SCADA node using the Download link on the GlobalScript configuration page.
Alarm triggered Scripts
Script files can run once when tag goes into an alarm state. Script files in TCL, JScript, VBScript, JScript encoded, or VBScript encoded formats are all supported. A script can run as a local screen script by pre-appending the file name with local!. The script file be run once as a local script inside the first available ViewDAQ, if any, on the SCADA node and inside the first available View client on each computer connecting to the SCADA node. If the local! option is not specified , the script file will be run once as a global script inside the global script engine on the SCADA node when tag is in the alarm state the script is associated with. For more information see sections 7.17 Alarm Triggered Scripts and 12.Scripts.
Event Triggered Scripts
The Event Logging feature in WebAccess
can be used to trigger a script to run based on a tag value or
change of state. An event log is configured as before specifying a
Tag to trigger the event and the type of event:
(Tag > = Value, Tag <= Value,
Tag >= reference Tag,
Tag <= reference Tag,
or record every sample interval.
For more information see section 21.4.1.2 Event Triggered Scripts