Browsing with Dialogs
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

 

Browsing Tags and Servers using the OPC Web Client ActiveX Controls

OPC Browsing

Take a look at the OPC Browsing Tutorial.

There are 3 browsers available:

  1. PCs in your Local Area Network (see code for VBScript or JavaScript)
  2. OPC Server (see code for VBScript or JavaScript)
  3. Tags (see code for VBScript or JavaScript)

Each of these browsers has its own dialog which can be called, or has methods available that allow you to programmatically accomplish the same result.

In this page you can see how to use all of the dialog-based browsers using VBScript or JavaScript.

Computer Browsing

VBScript

Copy the following code into a new HTML file:

<html>
<head>
<title>OPC Web Client Example - Browsing</title>
</head>

<body>
  <p><b><font size="3">OPC Web Client Example</font></b></p>
  <p><b><font size="2">Using PC Browser Dialog</font></b></p>
  <p><input type="button" value="Browse PCs on Network" name="b1"></p>
</body>
<script language="vbscript">
  sub b1_onclick
   Set o = CreateObject("OPCLabs.UserBrowseMachine")
   o.RunMe

   msgbox o..MachineName
  end sub
</script>
</html>

JavaScript

    <html>
    <head>
    <title>OPC Web Client Example - Browsing</title>
    </head>

    <body>
    <p><b><font size="3">OPC Web Client Example</font></b></p>
    <p><b><font size="2">Using PC Browser Dialog</font></b></p>
    <p><input type="button" value="Browse PCs on Network" name="b1" onclick="b1_onclick()"></p>
    </body>
    <script language="jscript">
    function b1_onclick()
    {
      var o = new ActiveXObject("OPCLabs.UserBrowseMachine");
      o.RunMe();
      alert(o.MachineName);
    }
       </script>
    </html>

OPC Server Browsing

VBScript

Copy the following code into a new HTML file:

<html>
<head>
<title>OPC Web Client Example - Browsing</title>
</head>

<body>
  <p><b><font size="3">OPC Web Client Example</font></b></p>
  <p><b><font size="2">Using OPC Server Browser Dialog</font></b></p>
  <p><input type="button" value="Browse Local OPC Servers" name="b1"></p>
</body>
<script language="vbscript">
sub b1_onclick
  Set o = CreateObject("OPCLabs.UserBrowseServer")
  o.MachineName = ""
  o.RunMe
  MsgBox o.ServerClass
end sub

</script>
</html>

JavaScript

    <html>
    <head>
    <title>OPC Web Client Example - Browsing</title>
    </head>

    <body>
    <p><b><font size="3">OPC Web Client Example</font></b></p>
    <p><b><font size="2">Using OPC Server Browser Dialog</font></b></p>
    <p><input type="button" value="Browse Local OPC Servers" name="b1" onclick="b1_onclick()"></p>
    </body>
    <script language="jscript">
    function b1_onclick()
    {
      var o = new ActiveXObject("OPCLabs.UserBrowseServer")
      o.MachineName = "";
      o.RunMe();
      alert(o.ServerClass);
    }
       </script>
    </html>

OPC Tag Browsing

VBScript

Copy and paste the code below into a new HTML file:

<html>
<head>
<title>OPC Web Client Example - Browsing</title>
</head>

<body>
  <p><b><font size="3">OPC Web Client Example</font></b></p>
  <p><b><font size="2">Using Tag Browser Dialog</font></b></p>
  <p><input type="button" value="Browse Tags in Server" name="b1"></p>
</body>
<script language="vbscript">
   sub b1_onclick
       Set o = CreateObject("OPCLabs.UserBrowseMachine")
       o.MachineName = ""
       o.ServerClass = " OPCLabs.KitServer.2"
       o.RunMe

       msgbox o.MachineName
   end sub
</script>
</html>

JavaScript

    <html>
    <head>
    <title>OPC Web Client Example - Browsing</title>
    </head>

    <body>
      <p><b><font size="3">OPC Web Client Example</font></b></p>
      <p><b><font size="2">Using Tag Browser Dialog</font></b></p>
      <p><input type="button" value="Browse Tags in Server" name="b1" onclick="b1_onclick()"></p>
    </body>
    <script language="jscript">
    function b1_onclick()
    {
      var o = new ActiveXObject("OPCLabs.UserBrowseItem")
      o.MachineName = "";
      o.ServerClass = "OPCLabs.KitServer.2";
      o.RunMe();
      alert(o.ItemID);
    }
      </script>
    </html>

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