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:

Code:
import win32com.client psApp = win32com.client.Dispatch("Photoshop.Application") psApp.Open(r"C:\test.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\test.py", line 3, in <module>
psApp.Open(r"C:\test.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\n- 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.




Just got this solved thanks to some help from polycount. It was User Access Control! Hopefully if anyone gets this problem, google will lead them here :)


Yup. If you plan to do much COM work, do yourself a favor and turn UAC off. In fact, turn it off anyway.