views:

357

answers:

2

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 :)

+2  A: 

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.

1800 INFORMATION
+4  A: 

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.

Sinan Ünür
+1 for getting the user to know of VBA editor
shahkalpesh
if VS 2005 can't be used here, do you have any alternative for the automation? i still need to automate VS2005 though.
flisterz
VS2005 has a macro editor that uses .Net, perhaps you can use that?
1800 INFORMATION