Copy link to clipboard
Copied
So, along with others' help, I've created a script that takes existing documents that are all opened up in Illustrator, centers the view of the artboard, prints active document, embeds any place objects, saves and closes, and then moves onto the next document until all open documents have been processed.
This is an amazing time saver for what I'm doing, but it doesn't work all the time.
What happens is that, sometimes, it stops during the print line of the code and says Error 1200, and I can't figure out why some documents do just fine, and why some get this error.
Here is the code for anyone who would like to help. Thanks for any feedback I get!
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
while (documents.length > 0) {
executeMenuCommand("fitin");
app.activeDocument.print()
for (var i = 0; i < app.activeDocument.placedItems.length; i
++) {
app.activeDocument.placedItems[i].embed();
}
app.activeDocument.save()
app.activeDocument.close()
if (app.documents.length > 0){
app.documents[app.documents.length-1].activate();}
}
you need to loop backwards when embedding the images
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
while (documents.length > 0) {
executeMenuCommand("fitin");
app.activeDocument.print()
for (var i = app.activeDocument.placedItems.length -1; i>=0; i--) {
app.activeDocument.placedItems[i].embed();
}
app.activeDocument.save();
app.activeDocument.close();
}
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;
Copy link to clipboard
Copied
you need to loop backwards when embedding the images
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
while (documents.length > 0) {
executeMenuCommand("fitin");
app.activeDocument.print()
for (var i = app.activeDocument.placedItems.length -1; i>=0; i--) {
app.activeDocument.placedItems[i].embed();
}
app.activeDocument.save();
app.activeDocument.close();
}
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;