Python + Photoshop


Hi eharper and rgkovach123

Finally I gave up trying to use COM to script AE. I went with JSX (and it’s quite a lame scripting language imo…)
I was triying to achieve the following scenario :
[li]Our compers need to get the AEP files of a shot to work locally on their machines
[/li][li]A python script allows them to choose a shot.
[/li][li]This script check with shotgun if the shot hasn’t been already assigned and a valid precomp (that is coming from another studio) version exists
[/li][li]If everything meets the expectation, then the AEP file is copied in an arborescence similar to the one on the server
[/li][li]The sources are staying on the server though, because we don’t want to slow everyone down by copying a few gigs.
[/li][li]Then I open After from Python using [/li]```

[li]I must patch the sources to be remapped to the network ones (Using JSX script). Which brings me to a subquestion that you might shine a light on. I have a PSD file imported as comp in my source Aep file, is there an easy way to replace it ? Right now I am reimporting the PSD file and doing a [/li]```

but I wonder if there’s a better solution.

Finally, after the comper has done his/her work, they have to publish it. Which means I have to do the reverse process, plus copy some files in the server arborescence and update shotgun.
There I’m quite done here.
I tried your commands and here’s the output


Traceback (most recent call last):
  File "<pyshell#25>", line 1, in <module>
  File "C:\Python27\lib\comtypes\client\", line 224, in CreateObject
    clsid = comtypes.GUID.from_progid(progid)
  File "C:\Python27\lib\comtypes\", line 78, in from_progid
    _CLSIDFromProgID(unicode(progid), byref(inst))
  File "_ctypes/callproc.c", line 945, in GetResult
WindowsError: [Error -2147221005] Chaîne de classe incorrecte
>>> comtypes.client.CreateObject('AfterEffects.Project.100')
<POINTER(IUnknown) ptr=0x3dd140 at 293f0c8>
>>> comtypes.client.CreateObject('AfterEffects.Project.130')
<POINTER(IUnknown) ptr=0x3dd170 at 32f0ac8>

I can’t figure how to use this pointer.

Thanks a bunch guys


The idea here is that you need to reference your open Object to a variable e.g.:

from comtypes import client as ct

myApp = ct.CreateObject('AfterEffects.Application.130')


Hope that helps and you solved your issue anyhow :wink:


There is also a class on Photoshop scripting and pipeline from Rigging Dojo