durs / node-activex

Node.JS Implementaion of ActiveXObject
MIT License
329 stars 62 forks source link

Type Mismatch Error #117

Open SerafinTech opened 1 year ago

SerafinTech commented 1 year ago

I am getting this error:

let errors = opc_items.Validate(tagList.length, tagList)
                       ^

Error: DispInvoke: Validate Type mismatch.
 on last line of following code:

From this code:

let winax = require('winax');

let con = new winax.Object('Graybox.OPC.DAWrapper');

con.Connect('Matrikon.OPC.Simulation.1', 'localhost')
con.ClientName = 'OpenOPC';

let groups = con.OPCGroups
groups.DefaultGroupUpdateRate = -1
let opc_group = groups.Add()
opc_group.IsSubscribed = 1
opc_group.IsActive = 1
let opc_items = opc_group.OPCItems
let tagList = ['Random.Real8']
let errors = opc_items.Validate(tagList.length, tagList)

Specification for the function:

Validate (Count As Long, ItemIDs() As String, ByRef Errors() As Long, Optional RequestedDataTypes As Variant, Optional AccessPaths As Variant)

other object methods work with no problem. AddItem method of OPCItems object cause nodejs to exit with no error.

Attached is the library docs OPC DA Auto 2.02 Specification.pdf

durs commented 1 year ago

Hello, could it be like this:

let v_errors = new winax.Variant([], 'long');

opc_items.Validate(tagList.length, tagList, new winax.Variant(v_errors, 'byref'))

"ByRef Errors() As Long" not Optional and not RetVal

сб, 10 дек. 2022 г. в 21:24, Jason Serafin @.***>:

I am getting this error:

let errors = opc_items.Validate(tagList.length, tagList) ^

Error: DispInvoke: Validate Type mismatch. on last line of following code:

From this code:

let winax = require('winax'); let con = new winax.Object('Graybox.OPC.DAWrapper'); con.Connect('Matrikon.OPC.Simulation.1', 'localhost')con.ClientName = 'OpenOPC'; let groups = con.OPCGroupsgroups.DefaultGroupUpdateRate = -1let opc_group = groups.Add()opc_group.IsSubscribed = 1opc_group.IsActive = 1let opc_items = opc_group.OPCItemslet tagList = ['Random.Real8']let errors = opc_items.Validate(tagList.length, tagList)

Specification for the function:

Validate (Count As Long, ItemIDs() As String, ByRef Errors() As Long, Optional RequestedDataTypes As Variant, Optional AccessPaths As Variant)

other object methods work with no problem. AddItem method of OPCItems object cause nodejs to exit with no error.

Attached is the library docs OPC DA Auto 2.02 Specification.pdf https://github.com/durs/node-activex/files/10200656/OPC.DA.Auto.2.02.Specification.pdf

— Reply to this email directly, view it on GitHub https://github.com/durs/node-activex/issues/117, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEMMNILPRCCNYPCY4QMV6LWMTDHFANCNFSM6AAAAAAS2NIBLY . You are receiving this because you are subscribed to this thread.Message ID: @.***>