Promotic
WikipediaLinkedInYoutubeTwitterFacebook

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)

 

Calling methods

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 ().

Example:
Let's have the PmTimer object with the name "Timer" defined in the objects tree.
Dim val, x1, x2, fx1, fx2
If Pm.Linear(val, x1, x2, fx1, fx2, 3)>10 Then
  pMe.Pm("/Timer").StartEx 2, 10
End If

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:

object.property

 
object reference to the object
property name of the object 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.

 
Example:
There is a PmData type object inserted in the "Folder" object (of the PmFolder type) in the application tree with data items named "Temperature1", "Temperature2" and "SumaTeplot".
Dim oData, temp1, temp2
Set oData = pMe.Pm("/Folder/Data")
temp1 = oData.Item("Temperature1").Value
temp2 = oData.Item("/Folder/Temperature2").Value
oData.Item("SumOfTemperatures").Value = temp1 + temp2
or
oData.Item("SumOfTemperatures").Value = oData.Item("Temperature1").Value + oData.Item("Temperature2").Value
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice