So decided to try and apply what I learned in python thanks to Jason Parks awesome webinar and just wanted to try my hand at some photoshop scripting since right now doing some texture work. Anywho, following Adam’s blog post about COM and python and for some reason the code breaks at the open stage. Here’s the code:
import win32com.client
psApp = win32com.client.Dispatch("Photoshop.Application")
psApp.Open(r"C: est.jpg")
doc = psApp.Application.ActiveDocument
layer = doc.ArtLayers[0]
layer.AdjustBrightnessContrast(20,-15)
doc.Save()
pretty much a copy and paste and I get this as an error
Traceback (most recent call last):
File “C:\Users\Alistair Braz\workspace\Test est.py”, line 3, in <module>
psApp.Open(r"C: est.jpg")
File “C:\Python26\lib\site-packages\win32com\client\dynamic.py”, line 505, in getattr
ret = self.oleobj.Invoke(retEntry.dispid,0,invoke_type,1)
pywintypes.com_error: (-2147352567, ‘Exception occurred.’, (0, u’Adobe Photoshop’, u’Illegal argument - argument 1
- Required value is missing’, None, 0, -2147220262), None)
Any ideas? I thought it was 2.7 been weird so moved to 2.6 and still nothing. Installed 2.6 pywin and getting same thing. Photoshop is 64bit and I installed the 64bit version of pywin too.
EDIT: Uninstalled and re-installed and nothing. Did some COM stuff with Word and worked. Gonna try and install Photoshop 32bit and see if anything happens.