Browsing
Home Product
Details Free 
Demo Pricing &
Ordering Related
Products Support About Us

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:

  1. OPC Servers
  2. Groups (aka BRANCHES)
  3. 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.

Copyright Software Toolbox, Inc., 1996-2004, All Rights Reserved Worldwide.
148A East Charles Street, Matthews, North Carolina, USA 28105
Phone: 704-849-2773 or 1-888-665-3678 (US), Fax: 704-849-6388
sales@softwaretoolbox.com | support@softwaretoolbox.com