Hi, anyone knows what is the problem with this function, i believe i did
everything right, but it just does not open the cd-rom, maybe the
problem is in the part “InvokeVerb”. Any help would be highly
appreciated.
It is known problem.
InvokeVerb does not work in Win32OLE (in Ruby 1.8).
Instead try to use doIt. @ej1 = @shell.NameSpace(name) @ej2 = @ej1.Self
verbs = @ej2.verbs
verb = nil
verbs.each do |v|
if v.name == “Expu&lsar”
verb = v
end
end
if verb
verb.doIt
end
FYI, in Ruby 1.9, InvokeVerb works by using WIN32OLE_VARIANT class.
I was unable to test my earlier code suggestion at the time of
posting. As you say, InvokeVerb does not work as expected, but the
[verb.doIt] method you suggested works well (for me)…
WIN32OLE.new(“Shell.Application”).NameSpace(17).ParseName("D:
").Verbs.each do |verb|
verb.doIt if verb.Name == “E&ject”
end
Thanks again!
David M.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.