Skip to main content
May 18, 2014
Question

Print and Save

  • May 18, 2014
  • 1 reply
  • 155 views

If I have 2 opened documents, I want to print and then save, but I found if I put aDoc.close(SaveOptions.no);, it will not print the second file, how can I make it to print one document and close that document and then print second document ......

myTest();

alert("Finished");

function myTest(){

    for (i=0; i<app.documents.length; i++) {

  var aDoc = app.documents;

        if (aDoc.printPreferences.pageRange != ""){

            alert("a");

            aDoc.print(true);

         //   aDoc.close(SaveOptions.no);

                  }

      }

  }

This topic has been closed for replies.

1 reply

Jump_Over
Legend
May 18, 2014

Hi,

Iterate backward or print always app.documents[0].

Notice that closing a doc changes indexes across a collection

Jarek