using a combo of adobe supplied script and the coding above, the following should work, but does not. Can anybody help me out as to why? The message I receive is:
"AppleScript Error: Adobe Photoshop CS2 got an error: Can’t get document “Untitiled-1”
tell application "Finder" to set theFilePath to (home as string) & "Desktop:test2.jpg"
tell application "Adobe Photoshop CS2"
make new document
set theDoc to current document
export theDoc in file theFilePath as save for web with options {class:save for web export options, format:JPEG, quality:80}
end tell
export theDoc in file theFilePath as save for web with options {class:save for web export options, optimized size:true, quality:80, with profile:false}
That works but it saves as a GIF (the default). Adding the “format:JPEG” causes an error. I believe this is a bug since I have tried it from every angle and can’t get it to save as a JPEG.
My solution was to trigger the “Edit in ImageReady” menu item with System Events (I am in Mac OS 10.3.9 in CS2). In ImageReady, you can record an Action that sets the format as JPEG and the target file size in the “Optimize” palette. You can then trigger the action in your script. Here is my code. You will have to adapt it a bit I am sure, but this is the main part you will need.
–Once you are already in PhotoShop with the image open:
tell application “System Events”
pick menu item “Edit in ImageReady” of menu “File” of menu bar item “File” of menu bar 1 of process “Adobe Photoshop CS2”
end tell
delay 2
tell application "Adobe ImageReady CS2"
activate
delay 3
do script "NameOfAction"
end tell
tell application "System Events"
pick menu item "Save Optimized As..." of menu "File" of menu bar item "File" of menu bar 1 of process "Adobe ImageReady CS2"
delay 1
key down command
keystroke "d" --sets the path to the desktop
key up command
keystroke ("Name of file" & return)
delay 3
key down command
keystroke "w" --Closes document after saving
delay 2
keystroke "d" --selects don't save at prompt
key up command
end tell
I have the same problem, so I find this topic here. But to save changes with “Remember” doesnot works correctly some times. So I made an Applescript app and a PhotoShop action, see < https://hahn-mediaservice.net/private/Gast/ >. Click on “Downloadbereich” and choose folder “export_options_save_for_web”.
In case anyone was wondering, in PhotoShop CS3 the save for web bug is fixed. The syntax is slightly different.
export current document in file (MyPathAndFileName & ".jpg") as save for web with options {web format:JPEG, optimized size:true, quality:40, with profile:false}
Model: G5 OSX 10.4.8
Browser: Safari 419.3
Operating System: Mac OS X (10.4)