![background image](http://html1.mh-extra.com/html/omron/cx-supervisor-script-reference-rev2-0/cx-supervisor-script-reference-rev2-0_reference-manual_744212040.webp)
OMRON
CHAPTER 4 – CX-Supervisor Script Language
Revision 2.0
Page 27
For instance, in order to dynamically change the Boolean point a toggle button is linked to follow
these steps.
1, 2, 3…
1.
Link the toggle button to a textpoint using indirection e.g. ^textpoint.
2.
Link the following script code to run as required. e.g. on clicking a button.
•
Text = ValueToText(index)
•
TextPoint = “motor” + text
3.
The ValueToText function converts the integer value of the point ‘index’ into a
string held in the textpoint ‘text’. Therefore the point ‘text’ contains either ‘1’,
‘2’, ‘3’ or ‘4’. The expression ‘motor’ + text appends the contents of the point
‘text’ to the literal string ‘motor’. Therefore ‘textpoint’ contains either
‘motor1’, ‘motor2’, ‘motor3’ or ‘motor4’ dependant on the value of ‘index’.
Change the value of the ‘index’ to determine which Boolean point to control.
e.g. via the Edit Point Value (Analogue) animation.
Point Arrays within Script Commands and Expressions
It is possible to access the elements of a point array directly or indirectly from within scripts or
expressions.
♦
Setting the value of an array point directly;
arraypoint[2] = 30
♦
Getting the value of an array point directly;
value = arraypoint[2]
♦
Setting the value of an array point using indirection;
textpoint = “arraypoint”
^textpoint[2] = 30
♦
Getting the value of an array point using indirection;
textpoint = “arraypoint”
value = ^textpoint[2]
An example using Point Arrays
The value of array points can be seen in a situation where it is necessary to dynamically change the
pointname that an object is linked to. In the following example a toggle button is configured to
control the Boolean state of one of four elements of an array point.
The Boolean array point ‘motor’ is configured to contain 4 elements.
The integer point ‘index’ (which has a range 0-3) is used to dynamically change the element of the
point being controlled.
Summary of Contents for CX-SUPERVISOR - SCRIPT REFERENCE REV2.0
Page 2: ...CX Supervisor Script Language Software Revision 2 0...
Page 3: ......
Page 5: ...CX Supervisor Script Language OMRON Page ii Revision 2 0...
Page 7: ...CX Supervisor Script Language OMRON Page iv Revision 2 0...
Page 9: ...CX Supervisor Script Language OMRON Page vi Revision 2 0...
Page 13: ......
Page 15: ...CHAPTER 1 Introduction OMRON Page 2 Revision 2 0...
Page 19: ...CHAPTER 2 Expressions OMRON Page 6 Revision 2 0...
Page 21: ...CHAPTER 3 Scripts OMRON Page 8 Revision 2 0...
Page 151: ...CHAPTER 8 Colour Palette OMRON Page 138 Revision 2 0...