I have the script partially working. It saves all the open psd as jpg into into a separate directory and it close some of the open files not all. The directory has five files. The script saves only three files, What am I doing wrong?
#target photoshop
if(app.documents.length >0){
//flatten the active document
app.activeDocument.flatten();
//jpeg options
var myJPEGOptions =newJPEGSaveOptions();
myJPEGOptions.embedColorProfile =true;
myJPEGOptions.formatOptions =FormatOptions.STANDARDBASELINE;
myJPEGOptions.matte =MatteType.WHITE;
myJPEGOptions.quality =12;
myJPEGOptions.scans =3;
// get documents;
var docs = app.documents;
for(var m =0; m < app.documents.length; m++){
app.activeDocument = docs[m];
try{
//save file to folder
var myFile =newFile(("~/Desktop/forum-test")+"/"+ activeDocument.name);
app.activeDocument.saveAs(myFile, myJPEGOptions,true);
//close the document
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
catch(e){
alert ("Error the script did not execute");
}
}
}