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

|
|
|
|
|

|
|
The following page contains source code to:
- Write to a single Tag
- Write to many tags within a single transaction
- Write to a Tag that is of type ARRAY
Writing a single Tag
Option Explicit
Dim EasyDA Set EasyDA = CreateObject("OPCLabs.EasyDA3.0") EasyDA.WriteItemValue "", "OPCLabs.KitServer.2
", "Simulation.Register_I4", 12345
Writing to multiple Tags within a single transaction
Dim EasyDA Set EasyDA = CreateObject("OPCLabs.EasyDA3.0")
Dim Results Results = EasyDA.WriteMultipleItemValues("", "
OPCLabs.KitServer.2", _ Array("Simulation.Register_I4", "Simulation.Register_R8", "Simulation.Register_BSTR"), _ Array(23456, 2.34567890, "ABC"))
Dim I
For I = LBound(Results) To UBound(Results) If VarType(Results(I)) <> 10 Then WScript.Echo "Element " & I & ": success" Else
On Error Resume Next EasyDA.RaiseError Results(I)
WScript.Echo "** " & Err.Source & ": " & Err.Description & " (0x" & Hex(Err.Number) & ")" & " **"
On Error Goto 0 End If Next
Writing to an Array-Tag
dim objArray(9) For i=0 To 9 objArray(i) = i Next
set opcWebClient = CreateObject("OPCLabs.EasyDA3.0")
opcWebClient.WriteItemValue "", "SWToolbox.TOPServer", "Channel_1.Device_1.TagArray_1", "", objArray
If Err.Number = 0 Then
Msgbox "Ok, successfully wrote to Array Tag" Else Msgbox "Error: " & Err.Number & ", " & Err.Description End If
|
|

|
|
|
|

|
|
|