Stuggling here...
VBScript
I have a DLL loaded, and can create an Object;
Set objServer = CreateObject("Matrikon.OPC.Automation.1")
I can then create a new Object, based on a Property of the objServer (I think I am saying that right?)
Set objGroups = objServer.OPCGroups
Set objGroup = objGroups.Add("Group001")
The manual shows OPCGroups is a Property of OPCServer. Once I have called this Property, I am left with a new Object of type OPCGroups, that I can then call its Properties and Methods.
Syntax OPCGroups As OPCGroups
This works fine. I then continue, and get stuck when calling this function;
Syntax AddItems (Count As Long, ItemIDs() As String, ClientHandles() As Long, ByRef ServerHandles() As Long, ByRef Errors() As Long, Optional RequestedDataTypes As Variant, Optional AccessPaths As Variant)
It wants an Array of Strings. However, in VBScript, I always end up with an Array of Variants (VarType = 8204). When I try and pass my array, I get a Type Mismatch error. I can't find a way of strongly typing it to an Array of Strings; I'm not even sure it's possible.
Over to JScript
JScript
I perform the same first steps as above, but when I create the OPCGroups object;
var objGroups = objServer.OPCGroups;
Something hasn't worked. It hasn't actually created an OPCGroups object with all its associated Properties/Methods. When I try and call a Method
var objGroup = objGroups.Add();
It says the 'Object doesn't support this property or method'. It's as though it just created a generic/blank Object; not one typed as an OPCGroups object.
So. Can I workaround either of these issues?
Do Until objTextFile.AtEndOfStream Redim Preserve arrFileLines(i) arrFileLines(i) = CStr(objTextFile.Readline) i = i + 1 Loop