S
Stefano Masini
I'm trying to script Adobe InDesign CS from python thru COM, and I'm
having a horrible time to even get started.
I ran makepy, and chose "Adobe InDesign CS Type Library".
It produced a horribly named module inside the gen_py directory, and
when I run gencache.py -d I get this:
Cache is in directory C:\Python23\lib\site-packages\win32com\gen_py
Adobe InDesign CS Type Library -
{6926C15F-E97E-4b13-8658-A97D8C616945}
Therefore it looks like everything worked so far, and the type library
for InDesign has the Class ID {6926C15F-E97E-4b13-8658-A97D8C616945}
Now, when I write the following python code:
comApp = win32com.client.Dispatch('InDesign.Application')
print repr(comApp)
I get:
<COMObject InDesign.Application>
Which looks like a dynamic dispatch, rather that a static one, as it
should be since I ran makepy on purpose.
Indeed, I manually placed some print statements around the win32com
python source code and I figured out that the name
'InDesign.Application' (I also tried with 'InDesign.Application.CS')
maps to the Class ID {ABD4CBB2-0CFE-11D1-801D-0060B03C02E4}.
This is different from the one produced by makepy, and therefore the
dispatch method can't find anything in cache, and falls back to
dynamic behaviour.
Anybody have a clue on what's going on here?
I thought I ought to write something different that
'InDesign.Application'... so I tried 'Adobe.InDesign.Application',
'Adobe.CS.....' and all sorts of things, but no luck.
Once I chose the 'Adobe InDesign CS Type Library' from makepy, how do
I know what am I supposed to use as the parameter to Dispatch() ?
Thank you very much, I hope somebody helps me out.
Maybe with some useful readings...
having a horrible time to even get started.
I ran makepy, and chose "Adobe InDesign CS Type Library".
It produced a horribly named module inside the gen_py directory, and
when I run gencache.py -d I get this:
Cache is in directory C:\Python23\lib\site-packages\win32com\gen_py
Adobe InDesign CS Type Library -
{6926C15F-E97E-4b13-8658-A97D8C616945}
Therefore it looks like everything worked so far, and the type library
for InDesign has the Class ID {6926C15F-E97E-4b13-8658-A97D8C616945}
Now, when I write the following python code:
comApp = win32com.client.Dispatch('InDesign.Application')
print repr(comApp)
I get:
<COMObject InDesign.Application>
Which looks like a dynamic dispatch, rather that a static one, as it
should be since I ran makepy on purpose.
Indeed, I manually placed some print statements around the win32com
python source code and I figured out that the name
'InDesign.Application' (I also tried with 'InDesign.Application.CS')
maps to the Class ID {ABD4CBB2-0CFE-11D1-801D-0060B03C02E4}.
This is different from the one produced by makepy, and therefore the
dispatch method can't find anything in cache, and falls back to
dynamic behaviour.
Anybody have a clue on what's going on here?
I thought I ought to write something different that
'InDesign.Application'... so I tried 'Adobe.InDesign.Application',
'Adobe.CS.....' and all sorts of things, but no luck.
Once I chose the 'Adobe InDesign CS Type Library' from makepy, how do
I know what am I supposed to use as the parameter to Dispatch() ?
Thank you very much, I hope somebody helps me out.
Maybe with some useful readings...