GraphWorX32 - Getting Started With Scripting
GraphWorX32 - Getting Started With Scripting
Scripting
October 2013
Automation can be a powerful tool to expand the abilities of Reading from and Writing to a Process Point
your application beyond the standard functions of
GraphWorX32. You can find examples of scripting within The simplest way to read from or write to an OPC tag is to use
GraphWorX32 in the C:\Program Files\ICONICS\ automation for the GraphWorX32 Process Point object. This
GENESIS32\Examples\GraphWorX32\OLE Automation method lets GraphWorX32 do all of the work actually getting
directory in a standard GENESIS32 installation. This document the value of a tag. This script will simply manipulate the value
will introduce you to the basics of scripting in GraphWorX32 that GraphWorX32 has already received from the OPC server.
and some commonly used automation calls.
1. We need to add a process point to our display before we
Runtime and Configuration Scripts write any scripts. In GraphWorX32, go to Dynamics
Intrinsics Process Point… or click on the button in
In GraphWorX32, you can execute scripts both from runtime the dynamics toolbar. Click on your display to add the
and from configure mode. Runtime scripts are the most common. process point.
To create a runtime script, follow the steps below.
NOTE: The process point needs to exist on the display for this script
to work, but it needs not to be visible to your users. You can put the
1. Add a button to a new GraphWorX32 display. point on a hidden layer, behind another object, or even use a hide
2. Select “Run Script” as the Action. dynamic if desired.
3. Hit the “Create” button, type “Runtime” into the Script
Name field, then hit OK. 2. Click on the “Data Tags” button and select the OPC tag that
4. Between the “Sub Runtime” line and the “End Sub” line, you would like to manipulate with your script. When you
type this simple script: are done configuring your process point, click on “OK”.
MsgBox "Hello World" NOTE: You can use local variables too!