close/jpeg without dialog box

I have scripted a JPEG edit. Now I want to save and close THAT file (not save as or save with copy) without the JPEG options window showing.
I have tried a Photoshop droplet
I have tried AS save with options
I have tried “set display dialogs to never”
AS save without options
Save within the “tell document 1” statement
Save, outside the “tell document 1” statement"
“close saving yes” with options
Etc…

In short, I have not been able to edit and close/save the JPEG unattended. It would probably work if I did a save as or save with copy, my my intent was to avoid that. If anyone can recommend the syntax that will save and close the JPEGs without the dialog showing, I would be extremely appreciative. Presently, this portion of my script looks like this:

tell application “Adobe Photoshop CS”
activate
set display dialogs to never
open MyItem
tell current document
–do stuff
end tell
save with options {quality:12}
close current document saving no
end tell

One of the things I have done to avoid the dialog is to set the saving options first and later when closing the document I use these prepared options.


tell application "PhotoShop"
set myJPEGOptions to {class:JPEG save options, embed color profile:true, format options:standard, quality:8}
set docRef to current document
tell docRef
save in file (JPEGdest_path & UPC_FC as string) as JPEG with options myJPEGOptions appending lowercase extension without copying
end tell
end tell

Then to just close a document:


tell current document
close saving no
end tell

I prefer to use the current document to document 1 because I tend to several documents open or copies (duplicates) open and do not want to save an image incorrectly.
Hope this helps

i have a similar problem. i’m converting pictures. using a folder action script that triggers a ps action.

since there are different savepaths involved i can’t use “save as…” in my action. so i decided to copy my the images to be converted to their target locations, open them in ps do the changes, then use “save”. May be this workaround isn’t neither wwith ps cs??

your code doen’t compile on my computer. I’m using PS 7.0. Are you using ps cs (8.x)? Has the scripting interface changed?

The above script was just a snippet, so it was incomplete. This a complete script that compiles fine and runs.

property JPEGdest_path : path to desktop as string
set aFile to choose file of type {"TIFF", "EPSF"}
tell application "Adobe Photoshop 7.0"
	open aFile
	activate
	set myJPEGOptions to {class:JPEG save options, embed color profile:true, format options:standard, quality:8}
	set docRef to current document
	tell docRef
		save in file (JPEGdest_path & "test" as string) as JPEG with options myJPEGOptions appending lowercase extension without copying
	end tell
	tell current document
		close saving no
	end tell
end tell

that surprises me.

when i compile your script above ore the snippets you posted earlier i get syntax errors. the first one at the word options in the line

   set myJPEGOptions to {class:JPEG save options, embed color profile:true, format options:standard, quality:8} 

it compiles fine with PS8.

All this really is no big deal but it’s worth noting that my Photoshop 7 Dictionary gives no evidence at all that these wonderfuls things you do in the script would work. My PS7-dictionary knows only two commands: open, do script.

I’ve developed my script using the demo of PS CS/8.0 which has a full dictionary and everything works fine. The script is for a client so he has the current PS anyways.

Why is your PS 7.0 so much more scriptable than min??? :?:

The version you are using does not have the Applescript Update. I want to say that was 7.1 or something. Anyway, you need to update the PS7 version and you will get all the applescript capabilities. Without the update, all you will be able to do is “do script” and some other very basic stuff.

thanks.

i installed Photoshop 7.0 Scripting plug-in v.1.0.2a
from http://www.adobe.com/support/downloads/product.jsp?product=39&platform=Macintosh

now it works for me too with PS7.0.1