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:
- Look for the script you need on the adobe scripting forum. Most probably somebody has already written it and you can even choose among a few versions. If it’s not found, or what you found isn’t exactly what you want, you may post a request on the forum and there’s a good chance that someone would write (or adjust) the script for you because simple scripts are easy -- and naturally doesn’t take long to write.
- Download, install Action Recorder and try to record an action. In some cases, it works, in some cases it doesn’t work. I haven’t tested the plug-in thoroughly (for me it’s much easier to write scripts) so can’t tell you about it in detail, but you can give it a try.
- You can find a lot of scripts on the web. Here are some links.
- You can start learning scripting. Here are some resources for beginners.
- I’m planning to make a section on my site with scripts that can be used with batch processor. I’m going to provide detailed comments and explanation so even non-scripters could adjust them to their needs. Maybe I also I write a tutorial for total beginners.
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.
- gEventLog — for events (non-error) messages
- 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
Click here to download the script.