// SAVE JPG
function saveJPG(saveFile) {
var jpgOpts = new JPEGSaveOptions;
jpgOpts.embedColorProfile = true;
jpgOpts.formatOptions = FormatOptions.STANDARDBASELINE;
jpgOpts.matte = MatteType.WHITE;
jpgOpts.quality = 10; // QUALITY: 0 - 12
try {
app.activeDocument.saveAs(saveFile, jpgOpts, true, Extension.LOWERCASE);
} catch(e) {
var newSaveFile = new File(saveFile);
app.activeDocument.saveAs(newSaveFile, jpgOpts, true, Extension.LOWERCASE);
}
}