Copy link to clipboard
Copied
Having an issue with this script. It works fine when running it with the file open. But when adding an open file command, Illustrator give me an MRAP error?? Am I doing something wrong?
// Global
var idoc = activeDocument;
var saveOutDirectory = (File ("MyDirectory"));
// Save Out
function saveFile() {
for (var i = 0; i < idoc.dataSets.length; i++) {
currentDataset = idoc.dataSets;
currentDataset.display();
idoc.saveAs(File (saveOutDirectory + "/" + currentDataset.name + "_MyFile.pdf"), myOpts);
}
};
// Remove - Print Graphics and Artboards
function removePrintAB() {
var artbs = idoc.artboards;
for (var i = artbs.length-1 ; i >= 0; i--) {
if (artbs.name != "MySpecialArtboard") {
artbs.setActiveArtboardIndex(i);
idoc.selectObjectsOnActiveArtboard();
app.cut();
artbs.remove();
}}
};
// Duplicate Original File
var TempFile = (File (saveOutDirectory + "/" + idoc.name));
TempFile.copy (saveOutDirectory + "/" + "temp file.pdf" );
open(File (saveOutDirectory + "/" + "pellon_temp.pdf"));
removePrintAB();
saveFile();
maybe it's because when you open the new file, you have to re-declare your 'idoc' as it may be referencing the previous file.
Copy link to clipboard
Copied
maybe it's because when you open the new file, you have to re-declare your 'idoc' as it may be referencing the previous file.
Copy link to clipboard
Copied
Dude, Really? It worked. Re-declare in the save out function. Works perfect. Thanks one more time V.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now