Skip to main content
Participating Frequently
February 20, 2011
Question

plug-in or script to print unrelated, multiple InDesign files

  • February 20, 2011
  • 4 replies
  • 4091 views

Does anyone know of a plug-in or script that allows you to print unrelated, multiple InDesign files? Using a book does not work as each InDesign file has it's own print settings.


I'm looking for something similar to Zevrix's Batch Output, but for only the print feature. It allows you to print each InDesign file with the last print settings used for that file.


I greatly appreciate any help. Thank you.

This topic has been closed for replies.

4 replies

Inspiring
November 4, 2015

This is actually a very useful script but when I use the script it doesn't print in the order it is in the folder.

For example. I would have these documents below. It would print document 1, 10 and then 2-9. Would there be an additional line where I would place in the script to make it work?

Document1

Document2

Document3

Document4

Document5

Document6

Document7

Document8

Document9

Document10

Participating Frequently
February 25, 2011

So I just wanted to post this script as is b/c it works now. It still lacks a progress bar. And if I'm able, I'll post a revised version with a progress bar. But this will print multiple, separate InDesign files with their last saved print preset.

function createDialog(folder, allFilesList) {
     var d, showDialog, winspec;

     winspec = [
     "dialog { orientation: 'column', alignChildren: 'top', text: 'Multiple Print',",
     "  folderPanel: Panel {",
     "    name: 'Files to Print',",
     "    alignment: 'fill',",
     "    StText1: StaticText { },",
     "    StText2: StaticText { }",
     " }, okCancelGroup: Group {",
    "   orientation: 'row', alignment: 'center',",
     " } ",
     "}"].join("");

    d = new Window(winspec);
     d.folderPanel.StText1.text = myFolder.fullName;
     d.folderPanel.StText2.text = '(Found ' + myAllFilesList.length + ' files)';
     d.okCancelGroup.add('button', undefined, 'Go', { name: 'ok' } );
     d.okCancelGroup.add('button', undefined, 'Cancel', { name: 'cancel' } );

    showDialog = d.show();
     $.writeln("s"+showDialog);
     return showDialog;
}

var InDesignVersion=app.version.split(".")[0]

var myFolder = Folder.selectDialog();
if (!myFolder) exit();
var myAllFilesList = myFolder.getFiles("*.indd");

if (!myAllFilesList.length) {
     alert("No files to print.");
     exit();
}

var myDialogResult = createDialog();
if (myDialogResult == 2) {
     exit();
}

var i, f, files, uil;

suil = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel =
  UserInteractionLevels.neverInteract;

try {
  files = myFolder.getFiles("*.indd");
  app.print(files);
} catch (e) {
  alert("Caught error:" + e);
} finally {
  app.scriptPreferences.userInteractionLevel = uil;
}

Participating Frequently
February 21, 2011

This is so close. The dialog box comes up, but whether I hit "go" or "quit", or even if I try escape, the script proceeds anyway. Kind of defeating the point of the dialog box.

I tried adding in an if satement like the one from the PDF, but it freezes up at the dialog box and hitting "go" or "quit" does nothing, and I cannot escape out fo the script.

if (myDialog.show() ==1)
var myShowDialog = myDialog.show();

return myShowDialog;

I'm thinking it should be something besides "myDialog.show" but i'm not sure what.

Inspiring
February 21, 2011

.. each time you call myDialog.show(), the dialog pops up. So don't use it twice! Perhaps poor InDesign is getting confused there, and that's why it blocks.

As for quitting, use this. The dialog returns '1' for OK, '2' for Cancel, right? Then test it like this:

var myDialogResult = CreateDialog();  // use the value returned by myDialog.show() here
if (myDialogResult == 2) {  // Cancelled?
    exit();
}

.. rest of your script ..

John Hawkinson
Inspiring
February 20, 2011

This is certainly easy to script. Untested (so it probably needs a little help):

var folder = new Folder("/path/to/folder-of-files");

var i, f, files, uil;

uil = app.scriptPreferences.userInteractionLevel;

app.scriptPreferneces.userInteractionLevel =

  UserInteractionLevels.neverIntact;

try {

  files = folder.getFiles("*.indd");

  app.print(files);

} catch (e) {

  alert("Caught error:" + e);

} finally {

  app.scriptPreferences.userInteractionLevel = uil;

}

Since allegedly app.print() takes an array of files, it might well be the case that you're better off looping through the array of files and printing each one at a time, since that way you can find out when something goes wrong. Or possibly even opening the files and then printing them and closing them, one by one. But each of those is more work. So try the above.

It, of course, expects the files to be in a folder of their own, /path/to/folder-of-files. So change that.

John Hawkinson
Inspiring
February 20, 2011

Oh yes. You're new, so you probably need instructions on how to install a script (this is in JavaScript).

Try the directions at http://indesignsecrets.com/how-to-install-scripts-in-indesign.php (from Anne-Marie Concepcion), or for more florid graphical detail, see http://www.danrodney.com/scripts/directions-installingscripts.html. Maybe we should have a link on the side in this forum.