Calling object properties and methods
Properties and methods of objects in a script in the PROMOTIC system are accessed by the following scheme:
object.property or object.method (parameter)
Methods are functions that perform a specified action. To use the method functionality, the method must be called.
Syntax of an access to the method:
object.method[(parameter1, parameter2, ..)]
|object ||reference to the object whose method is called|
|method ||name of the object method|
|parameter ||list of the parameters passed to the method|
If the value returned by the method is required, the parameters of the method have to be closed into brackets (). If the value returned the by method is not required, the parameters of the method must not be closed into brackets ().
Let's have the PmTimer
object with the name "Timer" defined in the objects tree.
Dim val, x1, x2, fx1, fx2
Reading and writing into object properties
Properties of an object are the data of the object that are accessed by the object. To use the object properties, they must by accessed in a script.
Syntax of an access to the property:
Whereas the object property represents the specific value, it is handled as a variable. New value can be assigned to it, or vice versa its value can be assigned to a variable. The following example shows methods of the work with object properties.
There is a PmData
type object inserted in the "Folder"
object (of the PmFolder
type) in the application tree with data items named "Temperature1"
temp2 = oData.Item("/Folder/Temperature2").Value
oData.Item("SumOfTemperatures").Value = temp1 + temp2