if (documents.length == 0) { alert("There are no files open."); } else { var numdocs=documents.length; for (i=0; i doc.width) { doc.resizeImage(null, largeHeight, null, ResampleMethod.BICUBIC); } else { doc.resizeImage(largeWidth, null, null, ResampleMethod.BICUBIC); } var options = new ExportOptionsSaveForWeb(); options.quality = 70; options.format = SaveDocumentType.JPEG; options.optimized = true; var newName = doc.name.substring(0,doc.name.length-4)+'-large.jpg'; doc.exportDocument(File(doc.path+'/'+newName),ExportType.SAVEFORWEB,options); if (doc.height > doc.width) { doc.resizeImage(null, thumbHeight, null, ResampleMethod.BICUBIC); } else { doc.resizeImage(thumbWidth, null, null, ResampleMethod.BICUBIC); } var options = new ExportOptionsSaveForWeb(); options.quality = 70; options.format = SaveDocumentType.JPEG; options.optimized = true; var newName = doc.name.substring(0,doc.name.length-4)+'-thumb.jpg'; doc.exportDocument(File(doc.path+'/'+newName),ExportType.SAVEFORWEB,options); if (doc.height > doc.width) { doc.resizeImage(null,smallThumbHeight,null,ResampleMethod.BICUBIC); } else { doc.resizeImage(smallThumbWidth,null,null,ResampleMethod.BICUBIC); } var options = new ExportOptionsSaveForWeb(); options.quality = 70; options.format = SaveDocumentType.JPEG; options.optimized = true; var newName = doc.name.substring(0,doc.name.length-4)+'-small_thumb.jpg'; doc.exportDocument(File(doc.path+'/'+newName),ExportType.SAVEFORWEB,options); doc.close(SaveOptions.DONOTSAVECHANGES); } }