Script for saving JPGs is now presenting Save As dialog box
Hi
I have been using JJ Mack's script below as an action for saving JPGs for a couple of years on single open JPGs and batching JPGs using Bridge > Photosop > Batch without any problems. However, with the latest PS upgrade (24.0.0) when I try to batch JPGs using the script action I am presented with the Save As dialog box. I have tried the script with and without the app.displayDialogs lines but I'm still seeing the Save As dialog box.
If anyone can solve this problem for me I would be very grateful. Thanks in advance for any help I may receive. Cheers Leo
============================================
// app.displayDialogs = DialogModes.NO;
try {
var tmp = app.activeDocument.fullName.name;
ftype = decodeURI(tmp.substring(tmp.lastIndexOf("."),)).toLowerCase();
if (ftype==".nef" || ftype==".cr2" || ftype==".crw" || ftype==".dcs" || ftype==".raf" || ftype==".arw" || ftype==".orf") { throw "error1"; }
fname = app.activeDocument.name.replace(/\.[^\.]+$/, '');
SaveAsJPEG(activeDocument.path + "/" + fname, 10); // Quality Level 10
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); // or (SaveOptions.SAVECHANGES) or (SaveOptions.PROMPTTOSAVECHANGES)
// alert("The document has been saved as a JPEG!");
}
catch(e) {alert("The document has not been saved yet!")}
function SaveAsJPEG(saveFile, jpegQuality){
var doc = activeDocument;
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(File(saveFile+".jpg"), jpgSaveOptions, true,Extension.LOWERCASE);
}
// app.displayDialogs = DialogModes.YES;
====================================
