I'm using AppleScript to control Photoshop's web export, on a Mac running OS X 10.8.4. Essentially, I want to open a document and resave it using the Web Export options.
The following script snippet worked fine in Photoshop CS5:
onprocess_item(this_item)
setthePathtothis_itemasstring
tellapplication "Adobe Photoshop CS5"
openaliasthePath
settheDocumenttocurrent document
exporttheDocumentinthePathassave for webwith options {web format:JPEG, quality:60}
closetheDocumentsavingno
endtell
endprocess_item
However, if I change the application name to "Adobe Photoshop CC", then the script stops working. As soon as it reaches the request for 'current document', Applescript throws an error:
"Can't get document 'somedocument.jpg' of application "Adobe Photoshop CC".
where 'somedocument.jpg' is the name of my document. Note that AppleScript (or Photoshop) is aware of the document at some level - it shows the correct name. It just can't "get" it, and the whole process grinds to a halt.
If I open the document manually, then run an Applescript that just does the
settheDocumenttocurrent document
command, Photoshop gets the document object without difficulty.
I've tried inserting a delay after opening the file, or using different ways to refer to the current document. I've verified that Photoshop is actually aware of open documents by using 'count' to find out how many documents are open. However, nothing I can think of will make this previously functional script work with Photoshop CC.
Has anyone encountered this problem or found a workaround? Thanks.