PythonCOM: Finding a COM ProgID name?

Noah noah at noah.org
Fri May 9 14:31:16 EDT 2003


I am trying to script adobe illustrator 10 with Python.
I ran the COM Makepy utility on the Abobe Illustrator Type Library.

I'm having trouble finding the ProgID name of a COM object
that I registered with MakePy. How do get the ProgID or CLSID?
In general, how do I get the names of the interfaces that 
I can dispatch from a Type Library? 

There seems to be a gap between running MakePy; selecting a Type Library;
and then access the TLB interface by name.
MakePy only gives the descriptive names, not the ProgID name
necessary to Dispatch the COM interface.

I guessed and came up with this -- which works:
    win32com.client.Dispatch("Illustrator.Application")
But guessing seemed like a dumb answer.

Then I tried using gencache (as generated with 'makepy.py -i' option):
    from win32com.client import gencache
    tlb = gencache.EnsureModule('{14937A4C-9A34-48a9-853A-DA92323E3587}', 0, 1, 0)
And now I am able to use Python to inspect the methods of tlb.
This is fine, but is there a more direct way? I feel like I missed
something obvious.

Yours,
Noah




More information about the Python-list mailing list