CallAxMethod - method of the Pm object

Allows calling ActiveX object methods from JavaScript (input/output parameters, VBArray, etc.). ActiveX uses VBScript data types and conventions, but this method adapts JavaScript to be usable..
Variant CallAxMethod(String sReserved, Object oAxObject, String sAxMethod, Variant arglist)
var r = Pm.CallAxMethod("", oAxObject, sAxMethod, arglist)
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 paramater value. If there is PmArray among these paramaters then this array is automatically converted into VBArray.
Return values:
The value returned by called ActiveX method. If the ActiveX returned VBArray then this array is automatically converted into PmArray.
This method is not functional in Web panels.
VBScript and ActiveX support input/output parameters while JavaScript does not support such parameters. The method CallAxMethod allows passing of input/output parameter to the ActiveX method by auxiliary object PmMap as follows:
1) The PmMap auxiliary object is created.
2) The property ParValue 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 insted of the original parameter by calling the CallAxMethod method.
4) The output parameter value is read from the property ParValue.

Caution! If the input parameter is represented by PmArray then this array is automatically converted into VBArray. If the output parameter is represented by VBArray then this array is automatically converted into PmArray.

See also:
- PmaActiveX.Acx (property)
- PmgActiveX.Acx (property)
- Pm.CreatePmMap (method)
- PmMap.mapAdd (method)
The example of calling the "DBGetInfo" method of the AtouchX object for communication with AMiT 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().Create(5);
var nState = Pm.CallAxMethod("", oApp, "DBGetInfo", nWID, mInfo);
Pm.Debug("return INFO : " + mInfo.ParValue);

Pm9.00.02: Created
PROMOTIC 9.0.10 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
- Pm
- Abs
- CallAxMethod
- Cos
- E
- Exp
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice