|
Please use our Code Center to obtain source-code and example projects/solutions:
http://codecenter.softwaretoolbox.com
|
|
|

|
|
|
|
|

|
|
OPC Browsing
Take a look at the OPC Browsing Tutorial.
There are 3 browsers available:
- OPC Servers
- Groups (aka BRANCHES)
- Tags (aka LEAVES)
OPC Servers
option explicit
Dim EasyDA Set EasyDA = CreateObject("OPCLabs.EasyDA3.0")
Dim strMachineName strMachineName = ""
Dim ServerElements Set ServerElements = EasyDA.BrowseServers(strMachineName) Dim key For Each key In ServerElements.keys Dim server
Set server = ServerElements.Item(key) WScript.Echo server.ProgId Next
OPC Group Browsing
Dim EasyDA Set EasyDA = CreateObject("OPCLabs.EasyDA3.0")
Dim strMachineName
strMachineName = ""
Dim BranchElements Set BranchElements = EasyDA.BrowseBranches(strMachineName, "OPCLabs.KitServer.2", "")
Dim Key For Each Key In BranchElements.Keys
WScript.Echo "Key " & Key & ":" & "<br>" Dim BranchElement
Set BranchElement = BranchElements.Item(Key) With BranchElement WScript.Echo Space(4) & "Name: " & .Name
WScript.Echo Space(4) & "ItemID: " & .ItemID WScript.Echo Space(4) & "IsBranch: " & .IsBranch
WScript.Echo Space(4) & "IsLeaf: " & .IsLeaf WScript.Echo Space(4) & "HasChildren: " & .HasChildren
End With Next
OPC Tag Browsing
Dim EasyDA Set EasyDA = CreateObject("OPCLabs.EasyDA3.0")
Dim strMachineName
strMachineName = ""
Dim LeafElements Set LeafElements = EasyDA.BrowseLeafs(strMachineName, "OPCLabs.KitServer.2", "Simulation")
Dim Key For Each Key In LeafElements.Keys
WScript.Echo "Key " & Key & ":<br>" Dim LeafElement Set LeafElement = LeafElements.Item(Key)
With LeafElement WScript.Echo Space(4) & "Name: " & .Name
WScript.Echo Space(4) & "ItemID: " & .ItemID WScript.Echo Space(4) & "IsBranch: " & .IsBranch
WScript.Echo Space(4) & "IsLeaf: " & .IsLeaf WScript.Echo Space(4) & "HasChildren: " & .HasChildren
End With Next
Foot note: if your output is not to the console, but via Windows dialogs, then click here for instructions to change that.
|
|

|
|
|
|

|
|
|