Reply To: Script to Automate Image Export Renaming

#1240767
Brian Pifer
Participant

For the kids. This will write all the pages to your desktop. It assumes all the images that you are placing and exporting are jpegs, and that there is one linked item per page. It will export a high quality jpeg as the same name as the linked image name. Note that if the linked images are also on the desktop, it will overwrite them. Copy the text below into a plain text editor, and save it with the .jsx extension, then copy that file to your scripts folder. Run it on your open document.

app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.EXPORT_RANGE;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.HIGH;
var pages = app.activeDocument.pages;
for (var i = 0; i < pages.length; i++) {
var graphics = pages[i].allGraphics;
for (var j = 0; j < graphics.length; j++) {
if (graphics[j].itemLink.isValid) {
var fileToExport = File(“~/Desktop/” + graphics[j].itemLink.name);
app.jpegExportPreferences.pageString = (pages[i].documentOffset + 1).toString();
app.activeDocument.exportFile(ExportFormat.jpg, fileToExport, false);
break;
}
}
}

This article was last modified on April 28, 2020

Comments (0)

Loading comments...