win32ole question

C

Chris Morris

[Note: parts of this message were removed to make it a legal post.]

I have a 3rd party COM library, and this works in VBScript:

Set foo = CreateObject("Foo")
foo.Fields("FieldA") = 5
foo.Fields("FieldB") = "bar"
WScript.Echo foo.Fields("FieldA")
WScript.Echo foo.Fields("FieldB")


but I can't get the assignments to work in ruby:

foo = WIN32OLE.new("Foo")
foo.Fields("FieldA") = 5


it errors out on this, because the evaluation up until the assignment of
results in a Fixnum instance that has no "=" method or somesuch. I suspect
there's a way to workaround this with something like the _setproperty method
but I couldn't wrap my brain around it today. Anyone have a hint? Or is this
a weird edge case in the land of COM that win32ole can't work with?
 
M

Mitchell Hashimoto

Chris,

To set properties with win32ole, use the property syntax, rather than
accessing the property via method:

foo["FieldA"] = 5

Mitchell Hashimoto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top