CHAPTER 4 – CX-Supervisor Script Language
result = 45 + 754
Indirection within Script Commands and Expressions
It is possible to use text points directly or indirectly in place of literal string arguments within scripts
and expressions. For instance, each of the following commands has the same effect:
♦
Using a string literal;
PlayOLE("ole_1", 0)
♦
Using a textpoint directly;
textpoint = "ole_1"
PlayOLE(textpoint, 0)
♦
Using a textpoint indirectly via the '^' notation.
text = "ole_1"
textpoint = "text"
PlayOLE(^textpoint, 0)
It is possible to use text points indirectly in place of point name arguments within script commands.
For instance, each of the following commands has the same effect:
♦
Using a point name directly;
verbnumber = 0
PlayOLE("ole_1", verbnumber)
♦
Using a textpoint indirectly via the '^' notation.
verbnumber = 0
textpoint = "verbnumber"
PlayOLE("ole_1", ^textpoint)
An example using Indirection
The value of point indirection 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 points:
♦
The four Boolean points to be controlled are called 'motor1', 'motor2', 'motor3' and 'motor4'.
♦
The text point 'textpoint' is used to store the name of the Boolean point to be controlled.
♦
The text point 'text' is used to store the string value of the integer point 'index'
♦
The integer point 'index' (which has a range 1-4) is used to dynamically change the point being
controlled.
♦
Access to any of the four Boolean points 'motor1', 'motor2', 'motor3', 'motor4' can be achieved
by applying indirection to 'textpoint' using the '^' notation and changing the contents of
'textpoint'.
Page 26
'add two numbers
OMRON
Revision 2.0
Need help?
Do you have a question about the CX-SUPERVISOR - SCRIPT REFERENCE REV2.0 and is the answer not in the manual?
Questions and answers