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)
I am exploring COM objects in PowerShell. Found this great recipe, provided by Jaap Brasser, which is easy to run and answered my question.
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 registered COM objects, and for objects that support Ole Automation, open them and invoke methods.
I actually wrote a replacement for the SDK tool OleView (afaik it doesn't support calling methods only enumerating) unimaginatively called OleViewDotNet. You can get the source code here but as you'd need to compile it's likely it would be quicker to write the simple C# program or use Powershell.
What it does do is expose IDispatch methods (and some native interfaces) via a GUI so you can call them and it also provides an IronPython script window. You'd need to find your COM object by looking under "Registry -> CLSID By Name", find the entry (the filter can be used to select by name part) right click and select "Create Instance" that should show up a window similar to:
then select the "Operations" menu at the bottom and choose "Open Dispatch" to get the method/property window.
There's a lot more you can do with this but that's a simple overview.
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 :) )