win32com with Photoshop
Dave Brueck
dave at solussoftware.com
Mon Dec 9 11:13:13 EST 2002
On Mon, 9 Dec 2002, Grant Foster wrote:
> I am trying to automate Photoshop actions on a number of files. If I run the
> following code interactively from a python prompt, everything works as it
> should and the result (res) is -1. If I then run the script from a file,
> Photoshop and the file is opened and then closed again, but the action is
> not run and res is 0. Can anyone help?
>
> from win32com.client import Dispatch
>
> psapp = Dispatch("Photoshop.Application")
> psapp.Open("C:\JS1.jpg")
> res = psapp.PlayAction("test1")
> psapp = None
> print res
Well, for starters you need double backslashes in the string passed to
Open, e.g.:
psapp.Open("C:\\JS1.jpg")
But if it still doesn't work then try putting a call to time.sleep after
each command.
-Dave
More information about the Python-list
mailing list