Batch processor

This is a work in progress.

The script was written and tested in InDesign CC 2017 on Windows 10. Version 2.1. The previous version, in case someone is interested, is here

.

Originally this script was written to extend further the functionality of Rorohiko´s Action Recorder: you can record an action, export it to jsx-file and run it against a number of InDesign documents. Unfortunately, it hasn’t been developed any further beyond the beta version and became a dismissed case. At some point, I realized that this can be in some respect an analogous to Photoshop’s Batch and Action recorder features. Of course, we don’t have them now and it’s hardly we’ll see them in the foreseeable future. Of course, we don’t have them now and it’s hardly we’ll see them in the foreseeable future. But what we can do now is to use a similar approach. In fact, an action in Photoshop is a series of simple pre-recorded commands. With the batch processor, we can execute a sequence of simple scripts.

Now you must be asking me, “Well, how can I get these ‘simple’ scripts?” Here are some ideas:

How it works

You can select and run either a single script.

Or a set of scripts. In this case, I recommend you to add numbers at the beginning of their names to control the order of execution. Like so: 01_SomeName.jsx, 02_SomeName.jsx, 03_SomeName.jsx and so on

The progress bar displays the name of the file being processed.

The settings you select in the dialog box will be saved after you click the OK button so don’t have to select them again next time you run the script.

If Create log file on the desktop check box is on, a text file will be created on the desktop listing every document processed and the scripts executed.

If errors occur during the execution of the batch processor, they appear at the end of the log. For example, on the screenshot below, you can see an error message for an invalid file which can’t be opened by InDesign.

From the scripts executed by the batch processor you can add messages via two global variables that are available both to the ‘external’ batch processor and the ‘internal’ script it triggers.

  1. gEventLog — for events (non-error) messages
  2. gErrorLog — for error messages


These are arrays of text elements that can be added like so:

gEventLog.push("Completed the first script. So far, so good!");
gEventLog.push("Something went wrong in the second script!");

if Backup original InDesign documents check box is on, an original version of each indd-file is copied whose name begins with "Backup".

Note that backups are never overwritten: an incremental number is added after the "Backup" prefix. Also, the files whose names begin with "Backup" are skipped.

 

If Save documents on closing is on, the documents will be saved before closing. It works only for documents in the selected folder (and its subfolders).

Important note: the documents that have already been opened before running the script will be saved and remain open.

When the files are batch processed, all warnings (e.g. missing fonts, links, etc.) are turned off.

At the end the final report pops-up telling you the total number of documents processed, the time it took and, if errors occur, their number.

Plans for the future

The current version works only with JavaScript programming language but in the next version I am planning to make it work with Apple Script and VBScript as well. I guess this will give us huge possibilities: for example, we’ll be able to export a file from InDesign to PDF, open and modify it in Acrobat and finally send it by e-mail from Outlook or Mail. Or, we can process all the documents in the selected folder and optionally it’s subfolders getting the information about the links – name, path, modification date, size, etc. – and putting them directly into Access database or Excel spreadsheet. I’ll be happy to get any feedback from you: bug reports, new feature requests and ideas.

Click here to download the script.