Rem This example shows how unsubscribe from changes of a single item.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Option Explicit
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
WScript.ConnectObject Client, "Client_"
WScript.Echo "Subscribing..."
Dim handle: handle = Client.SubscribeItem("", "OPCLabs.KitServer.2", "Simulation.Random", 1000)
WScript.Echo "Waiting for 10 seconds..."
WScript.Sleep 10*1000
WScript.Echo "Unsubscribing..."
Client.UnsubscribeItem handle
WScript.Echo "Waiting for 10 seconds..."
WScript.Sleep 10*1000
Sub Client_ItemChanged(Sender, e)
If Not (e.Succeeded) Then
WScript.Echo "*** Failure: " & e.ErrorMessageBrief
Exit Sub
End If
WScript.Echo e.Vtq
End Sub