From: Tallak Tveide Date: 2010-01-23T00:13:09+09:00 Subject: Re: win32ole with COM method taking two out refs Hi I realize this is an old thread, but I am struggeling, I think, with the same issues. It occurs on a COM server that if freely available, namely Matrikon OPC Simulator (http://www.matrikonopc.com/products/opc-desktop-tools/index.aspx). I have attached the olegen file and also a script that fails in the same manner as described. I'm failrly sure that this should be scriptable as a pure python library exists that does the same (OpenOPC) What I did: ruby olegen.rb 'OPC Automation 2.0' > olegen_opc_automation.rb My application: ... items = Object.new # output errors = Object.new # output group.OPCItems.AddItems 1, ['', 'Random.Int1'], [0, 1], items, errors .. The olegen code for the method looks like this: # VOID AddItems # Adds OPCItem objects to the collection # I4 arg0 --- NumItems [IN] # BSTR arg1 --- ItemIDs [IN] # I4 arg2 --- ClientHandles [IN] # I4 arg3 --- ServerHandles [OUT] # I4 arg4 --- Errors [OUT] # VARIANT arg5 --- RequestedDataTypes [IN] # VARIANT arg6 --- AccessPaths [IN] def AddItems(arg0, arg1, arg2, arg3, arg4, arg5=nil, arg6=nil) ret = _invoke(1610743820, [arg0, arg1, arg2, arg3, arg4, arg5, arg6], [VT_I4, VT_BYREF|VT_ARRAY|VT_BSTR, VT_BYREF|VT_ARRAY|VT_I4, VT_BYREF|VT_ARRAY|VT_I4, VT_BYREF|VT_ARRAY|VT_I4, VT_VARIANT, VT_VARIANT]) @lastargs = WIN32OLE::ARGV ret end OPC is widely used in the automation industry, and I would so much like to use ruby as a tool. The possibilities are endless, but OPC is a key enabler for this to happen. So - any help is REALLLY appreciated ;-) Btw: I'm using ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] Attachments: http://www.ruby-forum.com/attachment/4408/files.zip -- Posted via http://www.ruby-forum.com/.