2
votes

I'm new with this Perl Win32::OLE automation. I have been reading and trying out some examples. I have a few questions (excuse me if i'm using incorrect terminologies - do correct me):

  1. Can OLE be used to automate Visual Studio 2005? I only found examples with Word, Excel and IE. How do you know which app can be used?

  2. How do I get the name of the program ID to be used. For instance, "Excel" in Win32::OLE->new('Excel.Application')

  3. How do I get the available functions for each programs. For instance, Workbook, only can be used with Excel, not Word.

Thanks for your time :)

3

3 Answers

5
votes

The Win32::OLE documentation provides a rudimentary starting point.

As for your questions:

  1. I do not think VS 2005 provides an OLE automation interface.

  2. See this post on PerlMonks.

  3. An excellent source of information for Microsoft Office applications is the Object Browser. You can access it via Tools -> Macro -> Visual Basic Editor. Once you are in the editor, hit F2 to browse the interfaces, methods, and properties provided by Microsoft Office applications.

2
votes

Typically, the OLE automation model is up to the software you are trying to automate. You can usually figure it out by looking at the documentation, for example for the Microsoft products it will be in MSDN. For Visual Studio and the Office tools, you can also use the macro recorder to help figure out the syntax, since you can record a script that does vaguely what you want and then modify it.

Also, Visual Studio comes with the tool called "OLE/COM object viewer" (Oleview.exe) which can be used to open and read the type libraries for some target software. The type library is usually contained within a .tlb or .dll file and contains the more or less full description of the OLE Automation types defined for the application. You can look at the .idl thus reverse engineered and try to figure out what kind of things are possible.

0
votes

To get a brief overview and introduction I would suggest looking at this The Perl Journal #10. Created by Jan Dubois.

Also here are some examples, if you havn't stumbled across it yet Examples

Hope it helps