Created
July 23, 2009 09:52
-
-
Save tallakt/152626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
opc_automation = WIN32OLE::new 'OPC.Automation' | |
# get list of servers | |
opc_automation.GetOPCServers | |
# Connect to specific server | |
opc_automation.connect 'Matrikon.OPC.Simulation.1' | |
opc_group = opc_automation.OPCGroups.Add | |
opc_items = opc_group.OPCItems | |
items = ['Bucket Brigade.Real8'] | |
# validate tag names | |
# errors = opc_items.Validate items.size, [0] + items | |
# add tags to group | |
# last list is client handles | |
server_handles, errors = opc_items.AddItems items.size, [0] + items, [0] + 1.upto(items.size).to_a | |
errors = opc_group.SyncWrite server_handles.size, [0] + server_handles, [0] + [99] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment