Highlighted

My printing script works (most of the time) but needs some fixing.

Community Beginner ,
Nov 05, 2020

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();}

}

TOPICS
Bug, Scripting

Views

26

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

My printing script works (most of the time) but needs some fixing.

Community Beginner ,
Nov 05, 2020

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();}

}

TOPICS
Bug, Scripting

Views

27

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 05, 2020 0
Adobe Community Professional ,
Nov 05, 2020

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;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 05, 2020 0
Resources