해결됨
How to export only certain files/links from Indesign to png or jpg?
I've been trying to compile exporting script from various scripts to export only Adobe Illustrator files ignoring jpgs/tiffs from id document to png format. Succeeded to "collect" only ai-files, but saving to png-format won't happen. What is wrong with it? My script is so far:
//#target "InDesign"
var exportPath = Folder.selectDialog("Choose export location");
if (exportPath != null) {
var doc = app.activeDocument;
for (var i = 0; i < doc.links.length; i++) {
var currentLink = doc.links[i];
if (currentLink.status == LinkStatus.NORMAL && currentLink.filePath.match(/\.ai$/i)) { //Choose only Illustrator links
try {
var myNewFileName = currentLink.name.replace(/\.[a-z]{2,4}$/i, '.png'); //Change extension to png
var newExportFile = new File(exportPath + "/" + myNewFileName); //New path + new file name
// Set EXPORT presets
app.pngExportPreferences.exportResolution = 300;
app.pngExportPreferences.antiAlias = true;
app.pngExportPreferences.pngQuality = PNGQualityEnum.MAXIMUM;
app.pngExportPreferences.pngColorSpace = PNGColorSpaceEnum.RGB;
app.pngExportPreferences.pngExportRange = PNGExportRangeEnum.EXPORT_RANGE;
//alert("New filename " + newExportFile); //Check to see that proper files been chosen
myNewFileName.exportFile(ExportFormat.PNG_FORMAT, myNewFileName); //Should export *.ai files to png, but no
} catch (e) {};
}
}
}
alert("Done!");