tags:

views:

34

answers:

2

I'm trying to automate a process by using a COM object from Python (win32com), but I'm not getting the expected results... Is there a tool to explore/test COM objects without having to write a specific program? I mean, is there something that allows e.g. to instantiate a COM object and call its methods?

(Basically I'm trying to find out if my unexpected results are win32com's fault, and I'd like to avoid installing Visual Studio to write a C# app)

+1  A: 

If you download the Windows SDK via the WebSetup you should be able to choose to just download the SDK tools. They include a program called Ole/COM Viewer (oleview.exe) that can be used to browse all registers COM objects, and if they support automation, open them and invoke methods.

Chris Becke
I'm sorry, but I can't figure out if I'm using it correctly.. I've found the object I need, I click on "Create instance" and it gets selected (bold text).. What should I do now? There are a few interfaces available, but when I double-click on any of them I get "IDataObject interface viewer only supports IID_IDataObject"
Joril
Likely the package is missing iviewers.dll, which oleview.exe requires in the same directory. See: http://www.autoitscript.com/autoit3/docs/intro/ComRef.htm
bob-the-destroyer
Thanks for chiming in! Anyway the iviewers.dll is there, and if I move it elsewhere OLEviewer complains, so I'm guessing it's using it.. Anyway maybe I'm using it in a wrong way, what's the procedure to call a method using OLEviewer? I can't figure it out :/
Joril
The problem is I suspect, that COM is a binary contract, so theres no general way to call into random interfaces. Well there is - it relies on the type information present when building 'dual' interfaces
Chris Becke
I see, thanks for your help all the same :)
Joril
A: 

For the record, I ended up writing a very small script using SciTe4AutoHotKey and AutoHotKey COM wrappers, no .Net required.
(and my unexpected results weren't Python's fault :) )

Joril