Update cookies preferences
Promotic

CallAxMethod - method of the Pm object

Description:
Allows calling ActiveX object methods in the JavaScript language (input/output parameters, VBArray, etc.).
ActiveX object uses VBScript data types and conventions, but this method provides JavaScript to be usable.
Syntax:
Variant CallAxMethod(String sReserved, Object oAxObject, String sAxMethod, Variant arglist)
Parameters:
sReserved(String) Reserved. An empty string ("") must be here.
oAxObject(Object) Reference to ActiveX object.
sAxMethod(String) Name of called method.
arglist(Variant) A variable number of parameters follows. These parameters are passed to the method called in the ActiveX object.
The parameters are are passed as input parameters value.
If there is PmArray among these parameters then this array is automatically converted into VBArray.
Return value:
The value returned by called ActiveX method.
If the method returned VBArray then this array is automatically converted into PmArray.
Note:
This method is not functional in Web panels.

VBScript and ActiveX support input/output parameters while JavaScript does not support such parameters.
The CallAxMethod method allows passing of input/output parameter to the ActiveX method by auxiliary PmMap object as follows:
1) The PmMap auxiliary object is created.
2) The "ParValue" property in the auxiliary object is set to the first value of the input parameter
If the passed value must be of certain type (integer, byte, single), then the ParType property can be used in the auxiliary object to define the data type of the input parameter.
Both steps 1 and 2 can be completed together by the PmMap.mapAdd method.
3) The reference to the auxiliary object is passed instead of the original parameter by calling CallAxMethod method.
4) The output parameter value is read from the ParValue property.

Caution!
If the input parameter is the PmArray object then this array is automatically converted into VBArray.
If the output parameter is VBArray then this array is automatically converted into PmArray.
See also:
- PmaActiveX.Acx (property)
- PmgActiveX.Acx (property)
- Pm.CreatePmMap (method)
- PmMap.mapAdd (method)
Example:
The example of calling the "DBGetInfo" method of the AtouchX object for communication with AMiT PLC devices, where the requested input/output value (mInfo) is of the VBArray type.
JavaScriptSelect and copy to clipboard

var oApp = pMe.Pm("../AtouchApp").Acx;
var mInfo = Pm.CreatePmMap();
mInfo.ParValue = Pm.CreatePmArray(1, 5);
var nState = Pm.CallAxMethod("", oApp, "DBGetInfo", nWID, mInfo);
Pm.Debug("return INFO: " + mInfo.ParValue);

History:
Pm9.00.02: Created
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- CallAxMethod
 
 
- Cos
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r.o.