Photoshop - save files without dialog box

I would love to change the resulution of images in certain folders on my Mac by using a Script.
The files might have aby bitmap format, jpeg, tiff, psd or others.

My script works fine except the saving bit.

When I use

close document saving yes

or just

save document

in some cases, when Photoshop hasn’t processed this file previously, i get an open dialog box for the saving options.
This occurs also when the script starts with the expression for not showing dialog boxes.

Is there any solution for this or do I have to write this huge if clause with export options for any possible file type ?

Help is very much appreciated.

Try using photoshop’s Actions. Hit record on the actions window, then close and save the file and hit “stop recording”. It has an option to display a dialog that is defaulted to “off”. Then call that action from your script.

tell application "Photoshop"
do script "Action 1"
end tell

don’t know if it will work but it’s something to try anyway…:confused:

I do a lot of photoshop Applescripting, and I think the best way to to this is what pilothigh said. First you’d want to create separate photoshop actions for each of the file types you need, and set the options for the saving of each file in the action, so you won’t be prompted for them when the script runs.

Then - your main applescript is where you’ll decide what action to run, based on the file type/creator (or both) of the file.

set theFile to choose file
tell application "Finder" to set fileType to file type of theFile

if fileType = "JPEG" then
	tell application "Adobe Photoshop CS2"
		open theFile
		do action "Save as JPEG" from "My Image Actions"
	end tell
else if fileType = "TIFF" then
	tell application "Adobe Photoshop CS2"
		open theFile
		do action "Save as Tiff" from "My Image Actions"
	end tell
	--etc..
end if

Hi,

u can use the save options (like open options, see: http://bbs.applescript.net/viewtopic.php?id=15047)

also look in the dictionary for all diff. save options.


tell application "Adobe Photoshop CS2"
	save in file destfile with options {class:TIFF save options, byte order:Mac OS, image compression:none, save layers:false, save spot colors:false}
end tell

Here a few save options:

Class TIFF save options: Settings related to saving a TIFF document
Elements:
Super classes:
save options
Properties:
byte order IBM PC/Mac OS – Default value is ‘Mac OS’ when running on MacOS, and ‘IBM PC’ when running on a PC
embed color profile boolean – embed color profile in document
image compression JPEG/LZW/none/ZIP – compression type ( default: none )
interleave channels boolean – are the channels in the image interleaved? ( default: true )
JPEG quality integer – quality of produced image. Only valid for JPEG compressed TIFF documents ( 0 - 12 )
layer compression RLE/ZIP – should only be used when you are saving layers
save alpha channels boolean – save alpha channels
save annotations boolean – save annotations
save image pyramid boolean – ( default: false )
save layers boolean – save layers
save spot colors boolean – save spot colors
transparency boolean

Class EPS save options: Settings related to saving an EPS document
Elements:
Super classes:
save options
Properties:
embed color profile boolean – embed color profile in document
encoding ASCII/binary/high quality JPEG/low quality JPEG/maximum quality JPEG/medium quality JPEG – type of encoding to use for document ( default: binary )
halftone screen boolean – include halftone screen ( default: false )
image interpolation boolean – use image interpolation ( default: false )
PostScript color management boolean – use Postscript color management ( default: false )
preview type eight bit Mac OS/eight bit TIFF/JPEG Mac OS/monochrome Mac OS/monochrome TIFF/none – type of preview ( default: monochrome TIFF )
transfer function boolean – include transfer functions in document ( default: false )
transparent whites boolean – only valid when saving BitMap documents
vector data boolean – include vector data

Class JPEG save options: Settings related to saving a JPEG document
Elements:
Super classes:
save options
Properties:
embed color profile boolean – embed color profile in document
format options optimized/progressive/standard – ( default: standard )
matte background color matte/black matte/foreground color matte/Netscape gray/none/semi gray/white matte
quality integer – quality of produced image ( 0 - 12; default: 3 )
scans integer – number of scans. Only valid for progressive type JPEG files ( 3 - 5 )

and so on…

Greets from
TMA

Model: PowerBook G4 15" 1,25 GHz
AppleScript: Script Debugger 3.0.9
Browser: Safari 416.12
Operating System: Mac OS X (10.4)