Copy link to clipboard
Copied
I've written a script in ExtendScript to process hundreds of image files. It works fine without any intervention if the original files are JPEGs. I however have started getting some PNG's. The script opens them fine and converts them to RGB. I set my JPEG save Options but when PS goes to save it brings up the Save As dialog box. Is there any way to avoid the dialog box?
My code:
var destFile = File(printFolder.fullName + "/" + doc.name);
var saveOptions = new JPEGSaveOptions( );
saveOptions.embedColorProfile = true;
saveOptions.quality = 12;
saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
saveOptions.matte = MatteType.NONE;
doc.saveAs (destFile, saveOptions, false );
Have you tried adding this to your code:
app.displayDialogs = DialogModes.NO;
Copy link to clipboard
Copied
Try this out.
function saveJPG(saveFile, jpegQuality) {
saveFile = (saveFile instanceof File) ? saveFile : new File(saveFile);
jpegQuality = jpegQuality || 7;
var jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);
}
Copy link to clipboard
Copied
Have you tried adding this to your code:
app.displayDialogs = DialogModes.NO;
Copy link to clipboard
Copied
Thanks Guys. Both options worked for me.