Ok, here are the questions:
- What is the relationship between ActiveScriptRuby and WIN32OLE? Is the
latter useful by itself?
The first is a stand-alone Ruby installation, while the latter is a loadable
So, if you have, for example, the PragProg Windows version, and you install
ActiveScriptRuby, you end up with two separate versions of Ruby.
- How does the scripter know what capabilities the target application has
under Windows? The example on page 168 of the PickAxe Book
assumes a lot of
knowledge on the part of the scripter about Excel’s internal objects. Mac
Excel has an object browser so it’s easy to see what objects are inside
Excel and to discover their methods. Does the same thing apply on
don’t have Win Excel but I do have IE and it’s supposedly
scriptable. I just
can’t discover the vocabulary to script it.
The VBA IDE that comes with Word, Excel, and other MS Office apps (or Visual
Studio IDE) provides very nice “IntelliSense ™”, which is a tremendous
help. Most of my knowledge of the MS Word DOM comes from hacking about with
VBA. However, there also used to be nice outlines and images of the Office
object models on msdn.microsoft.com. I don’t spend as much time on that
site as I used to :).
If you have the opportunity, try using the VBA IDE to write some code in
VBScript first, using the intelligence goodness, then port it to Ruby once
you know the names of objects and their method signatures.
- The PickAxe book talks about “dynamic lookups.” Could someone provide
some insight on how this works?
Dotted paths are expensive. For example, if you have
foo = Object.OtherObject.AndYetAnother.some_method
then Object has to go get a reference to OtherObject, which in turn must go
get a reference to AndYetAnother, which then invokes some_method.
If you then have
bar = Object.OtherObject.AndYetAnother.some_new_method
that same work is done all over again. That’s why, for example, in VB it’s
better to use With
foo = some_method
bar = some_new_method
The code gets the reference to AndYetAnotehr once, and reuses it for
In Ruby, with win32ole, it’s better to get a direct reference to the objects
you need, rather keep using dynamic lookup to get the object reference each
The secret of life is honesty and fair dealing. If you can fake that,
you’ve got it made. -Groucho Marx