ValueError: argument is not a COM object

S

Stefano Masini

Hi,

I'm scripting Adobe InDesign CS with python, through COM interface.

This is how I get the application object:

win32com.client.Dispatch('InDesign.Application')

I'm not a guru of com programming, but I've gone quite far in my
purpose so far.
Now I'm stuck.

There's a method Add in object Groups (which is in object Page, etc.)
that's supposed to take a parameter called GroupItems of type "Array
of Objects", according to the Visual Basic programming reference.

I have the following piece of code:

print 'obj1: %r, obj2: %r' % (comObjs[0], comObjs[1])
grps = self.page.comPage.Groups
grps.Add( GroupItems=(comObjs[0], comObjs[1]) )

Which gives me:

obj1: <COMObject <unknown>>, obj2: <COMObject <unknown>>

[...]
File "modPrint.py", line 204, in creaFrameLoghi
grps.Add( GroupItems=(comObjs[0], comObjs[1]) )
File "<COMObject <unknown>>", line 2, in Add
ValueError: argument is not a COM object


Why is it so?
I suppose the type system is having troubles figuring out the type of
the list elements.
So, what do I do?

I hope somebody can help,
thank you!
stefano
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top