From: Andreas Warberg Date: 2008-06-26T18:12:02+09:00 Subject: Ruby win32ole properties Hi I'm running simulations in Vissim using ruby and win32ole to connect to a COM server. I wish to set a parameter in the COM server using the following description from the manual: AttValue ([in] BSTR Attribute, [in] VARIANT Value) Sets an evaluation attribute. Please get the language independent attribute tag from the table at the end of this section. Parameters [in] BSTR Attribute : Attribute name (see below) [in] VARIANT Value : Attribute value. (type according to attribute) Example eval.AttValue(„VEHICLERECORD“) = True In Excel I have created the following sub to perform the task: Sub test() Dim vissim Set vissim = CreateObject("VISSIM.Vissim") vissim.LoadNet "mynet.inp" Dim eval Set eval = vissim.Evaluation MsgBox "Before: " & eval.AttValue("NODE") eval.AttValue("NODE") = 1 MsgBox "After: " & eval.AttValue("NODE") vissim.Exit End Sub Which works fine. In Ruby I am out of luck, however: def test vissim = WIN32OLE.new('VISSIM.Vissim') vissim.LoadNet 'mynet.inp' eval = vissim.Evaluation puts "Before: #{eval.AttValue('NODE')}" #eval.AttValue("NODE") = 1 # this doesn't work, obviously eval.AttValue["NODE"] = 1 # error here number of parameters puts "After: #{eval.AttValue('NODE')}" end Running test I get: C:/greenwaves/code/test.rb:33:in `method_missing': AttValue (WIN32OLERuntimeError) OLE error code:0 in HRESULT error code:0x8002000e Invalid number of parameters. I tried exchanging 'eval.AttValue["NODE"] = 1' with eval.AttValue("NODE",1) which also complains about the number of parameters. Apparently I can only access the getter-method. Is there something else I can try? Kind regards Andreas -- Posted via http://www.ruby-forum.com/.