• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Nov 05, 2020 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

173

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
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 05, 2020 Nov 05, 2020

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;

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 05, 2020 Nov 05, 2020

Copy link to clipboard

Copied

LATEST

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;

Votes

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
community guidelines