Martin Kahlert asked a similar question a few weeks ago, in the thread "Windows
automation":
http://rubyurl.com/pklBm [1]
Depending on what you want to do, you may find an answer there (there are about
3 suggestions in that thread, the worst of which is mine, I believe :).
Otherwise, check out Watir [2] and I'm sure there's at least one more project in
the RAA [1] that can help you with what you're trying to do.
Now, I'll try and answer your direct questions with some explanation of stuff
you don't seem to understand.
"InternetExplorer.Application" is known in Windows as a "program id". Others
might include "Excel.Application", "Word.Application", "Scripting.Regexp",
"Scripting.FileSystemObject" (but why would you use either of these latter from
Ruby?)
I am pretty sure you can substitute a program id in the WIN32OLE constructor
with a class id, which looks more like "{6BF52A52-394A-11D3-B153-00C04F79FAA6}"
(Flash object). It's just a different way to specify what OLE object to create.
How do you know what methods your new Flash object has? That's tricky - you
can't just use my_ole_object.methods, because it doesn't actually have any
special ones - it uses method_missing. You need to check the documentation for
the OLE object itself. When I'm developing using Word and Excel automation, I
usually develop that code in Word and Excel (record macros, use the help and the
object browser to help figure out how to do whatever I need to do) and then just
translate that to Ruby (it's pretty straightforward).
Cheers,
Dave
Minor note: You could probably use the #ole_methods method to get a
(partial) list of known methods. Doesn't give you any information on
method arguments though which is why you would probably need the
documentation anyway.
Cheers,
Thomas.
So whats the simply way of figuring out whats avilable? Simply just look
at the Object Browser that comes with office application. You can launch
the Vbscript editor that comes in Word or any of the other office apps
and then take a look at the Object Browser. This basically uses a COM
based reflection API to show you everything that office can do.
Further, if you pick up a book about VBA (Visual Basic for Applications)
programming, it will show a large part of the commonly used objects and
API.
Roshan
Hm - how hard would it be to get at this reflection API from ruby?
martin
OLE object browser, in Ruby.
http://homepage1.nifty.com/markey/ruby/win32ole/index_e.html
Adelle.
Thanks! That's pretty nifty.
martin
// -----Original Message-----
// From: Martin DeMello [mailto:martin...@yahoo.com]
// Sent: Thursday, March 17, 2005 1:35 PM
// To: ruby-talk ML
// Subject: Re: MS Windows automation - howto use it?
//
// Adelle Hartley <ade...@bullet.net.au> wrote:
// > > Hm - how hard would it be to get at this reflection API
// from ruby?
// >
// > OLE object browser, in Ruby.
// >
// > http://homepage1.nifty.com/markey/ruby/win32ole/index_e.html
//
// Thanks! That's pretty nifty.
//
// martin
//
//