Batch processor
The script was written and tested in InDesign 2024 on Windows 10 and on Mac.
Click here to download the latest version 5.7 which besides JavaScript (jsx / js / jsxbin), also supports AppleScript (scpt), Visual Basic Script (vbs) and UXP Script (idjs). See what’s new in versions 5.5–5.7.

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. 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.
- 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.
What’s new
Version 5.7
- When a script fails on a document, the log now says why: for example, failed: Test failure from my_script.jsx or failed: Object is invalid. Before, it said failed: undefined.
- The log no longer shows a misleading line number: for an error inside InDesign, the line InDesign reports belongs to the batch processor, not to your script.
- Your settings from version 5.6 (or 5.5) are taken over on the first run.
I tested versions 5.6 and 5.7 with a set of automated tests in InDesign 2024: failing scripts, templates, IDML files, documents from older versions, books, arguments files and the log.
Version 5.6
This is a bug-fix release. Most of the fixes are about keeping your files safe:
- If a script fails on a document, the document is not saved, so half-done changes never get into your files. A document the batch processor opened is closed without saving; a document that was open before stays open as it is.
- If anything goes wrong while a document is being processed, the document is closed without saving. Before, it could stay open (invisibly in the invisible mode) and keep its file locked.
- Templates (indt files) are always opened as originals, not as untitled copies.
- With All types, if a folder contains both Name.idml and Name.indd, the converted IDML file is saved as Name_converted.indd and never overwrites Name.indd.
- A document from an older version of InDesign is resaved in place only if Backup original InDesign documents is on (the backup is made first). Otherwise it is saved as Name_converted.indd and the original is kept, so you can still open it in the older version.
- The user interaction level is restored to what it was before running the script.
- Arguments file: lines inside a multi-line argument keep their indents; a custom separator may contain a quote and the escape sequences \t, \n, \\ and \uXXXX.
- You can run the batch processor without a script when Save documents on closing is on — to simply convert IDML files or resave documents from older versions.
- Only the backups made by the script (Backup_Name.indd, Backup(1)_Name.indd) are skipped — not every file whose name begins with “Backup”. Hidden folders and Mac packages are skipped when processing subfolders.
- The log file is written faster and uses the normal line endings of Windows and Mac.
- Your settings from version 5.5 are taken over on the first run.
Version 5.5
- The log file is created only when Create log file on the desktop is on.
- Documents converted from IDML or older versions are saved next to their source files.
- With Save documents on closing off, documents that were open before running the script are no longer closed without saving.
- An error in a script is logged and the batch goes on with the next document.
- Arguments file: it is read as UTF-8; comment-only lines don’t shift the positions of the arguments; URLs (http://) are not treated as comments.
- Scripts in a folder are sorted by their numeric prefix (1, 2 … 10) on both Mac and Windows.
- The final report shows the number of errors.
- A few problems in the dialog box were fixed.
Previous versions are here.
Here is the description of the way it works:
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.
The progress bar displays the name of the file being processed.

Process
You can run the script on one of the following:
- the active document
- all open documents
- the active book
- the documents in the selected folder
- the documents in the selected folder and its subfolders

From the drop-down list, you can choose what kind of documents to process:
- Documents (indd files)
- Templates (indt files)
- InDesign Markup (idml files)
- All types (indd & indt & idml files)

What to run
You can select and run either a single script.

Or a set of scripts located in the same folder. 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


Starting from version 4, the batch processor can run not only scripts written in JavaScript, but also in AppleScript (Mac) and Visual Basic Script (Windows). This gives us huge opportunities: for example, even though JavaScript is the most popular scripting language used for automating InDesign, you may be more familiar with alternative ones.
Also, using these languages you can make InDesign interact with other scriptable apps — like Microsoft Excel, Word, Access, Outlook, etc. — for instance, export each document as a minimum-size-pdf file, attaching it to e-mail and sending via Mail or Outlook, or 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. Possibilities seem to be limited only by your imagination!
Starting from version 5, you can also run modern UXP Scripts (idjs files, InDesign 18 (2023) and later) and process InDesign Markup (idml) files.
Windows — vbs, jsx, js, jsxbin and idjs files are available

Macintosh — scpt, jsx, js, jsxbin and idjs files are available

Documents folder
The Documents folder panel is activated only when you choose the documents in the selected folder (and its subfolders) option so that you can choose the folder to process.
Settings
If Create log file on the desktop checkbox 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 are written to the log as lines beginning with “ERROR”. For example, on the screenshot below, you can see an error message for an invalid file which can’t be opened by InDesign.

if Backup original InDesign documents checkbox is on, the original copy of each indd-file is kept: its name begins with "Backup_".
Note that backups are never overwritten: an incremental number is added after the "Backup" prefix. Also, the backups made by the script (Backup_Name.indd, Backup(1)_Name.indd, etc.) are skipped.

Backups created by the script loose their creation & modification dates due to JavaScript limitations.
If Save documents on closing is on, the documents will be saved before closing.
Important note: the documents that have already been opened before running the script will be saved and remain open. (This feature works in all versions starting from CS5: in earlier versions, all documents will be closed.)
If a script fails on a document, InDesign undoes that script’s changes, the error is written to the log, and the document is not saved: if the batch processor opened it, it is closed without saving; if it was open before, it stays open as it is.
Documents converted from IDML files or from older versions of InDesign are saved next to their source files:
- An IDML file is saved as Name.indd. If Name.indd already exists, it is overwritten only when Backup original InDesign documents is on (the backup is made first) and Name.indd isn’t processed in the same batch; otherwise the converted file is saved as Name_converted.indd.
- A document from an older version is resaved in place only when Backup original InDesign documents is on; otherwise it is saved as Name_converted.indd (or .indt) and the original is kept.
With Save documents on closing on, you can run the batch processor without selecting a script: it simply opens and resaves the documents, e.g. to convert IDML files or documents from older versions.
With Open in invisible mode checkbox on, open documents are not displayed on the screen which may decrease execution time. Note that a document opened in the invisible mode is not the active document, so your scripts should use g.doc instead of app.activeDocument (see below).
Arguments file (optonal)
Arguments file is a handy way to send some parameters (arguments) to the script.
Use arguments — tells the batch processor to use an argument file which is a plain text file created or edited in an application like Notepad, TextEdit. (Don’t use Word). When this checkbox is on, you obviously should select a file: either txt or csv.
The file contains a list (array) of parameters which can be delimited by return, line feed, comma, semicolon, pile, etc. Each element is a plain string, but it can be easily converted by a script to the necessary data type.
To put it simply, the argument file is a sort of preset file. For example, you may use one to create pdf-files for a printing office and another for ‘minimum size’ pdf-files to be sent by e-mail.
When the Ignore comments checkbox is on, the script ignores comments in the arguments file which are regular comments used in ESTK:
// your comment /* your comment */
With a lot of parameters, it is useful to comment each of them to avoid confusion.
Separator — here you can choose one of the following pre-built characters to separate (delimit) arguments:
- \\n (Line feed)
- , (Comma)
- ; (Semicolon)
- | (Pipe)
Also, you can type in whatever you want as a separator: custom. A custom separator may contain the escape sequences \t (tab), \n (line feed), \\ (backslash) and \uXXXX (any Unicode character by its code).

Arguments are passed via global g.arguments variable: an array of strings (or undefined if Use arguments is off). For example, you can read the first argument like so:
var myFirstParameter = g.arguments[0];
Here is a more detailed information and are examples of using this feature.
Important notes:
- Don’t use \\r as a separator — use \\n instead
- In InDesign CS3 and below the arguments feature is unavailable
Don’t use a global variable called 'g' in your scripts (written in JavaScript only) to be run from the batch processor because it’s used for data exchange between the primary and secondary scripts.

Use g.doc variable to send the current document from the batch processor to a secondary script. It always refers to the document being processed, whatever option you choose, so I recommend using it instead of app.activeDocument or app.documents[0]: in the invisible mode, and with the all open documents option, the document being processed isn’t necessarily the active one.
You can get feedback from your script using global g.WriteToFile() function. It has only one argument: the string that will be written onto the log file on the desktop. Here is an example of how to use it. g.WriteError() works the same way, but marks the line as an error, which is also counted in the final report. Both write only if Create log file on the desktop is on.
Don’t close g.doc in your script: the batch processor saves (if Save documents on closing is on) and closes it itself.
g.doc, g.arguments and g.WriteToFile() are available only in scripts written in JavaScript (jsx, js, jsxbin). AppleScript, Visual Basic Script and UXP scripts run separately: they work on the active document, so turn off the invisible mode for them.
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.

Developing scripts for the batch processor, I concluded it would be much better to make ‘universal’ scripts that work both:
- as regular standalone scripts that are run against the active document in InDesign or ESTK (it’s much easier for debugging)
- and as the scripts used with the batch processor
For this purpose, I developed a template that can be used as a starting point for a new script. Click here for more details and the download link.
Yet another important note: for very old versions only (e.g. CS3):
With InDesign version CS3 I had a problem: sometimes a script triggered ESTK and started loading data (object model for CS3) which would take till the end of the universe to complete.
To solve such a problem:
- Start ESTK
- Select InDesign as the target in the top left corner
Click here to download the latest version of the script.
From time to time, I find bugs and fix them. There’s a small possibility that fixing a bug would break something else. For example, in corona times, I can’t get to my office to test it on Mac. If this happens, you can download previous versions from here.
And finally one more note: why with some older InDesign versions AppleScript doesn’t work anymore when run from the batch processor? (In latest versions it works as expected).
See also Peter Kahrel's Batch-process (convert/export/import) documents script.
If you found this script useful and want me to develop it further, consider supporting me by donating via PayPal directly to my e-mail: askoldich [at] yahoo [dot] com. (Due to PayPal’s restrictions for Ukraine, I can’t have a Donate button on my site.)
Summary of the related pages:
- Scripts for the batch processor
- Template
- Arguments file
- Logging example
- Example of achieving the same task using different scripting languages
- A simple example of adding data from InDesign to Excel on Mac
- List links from InDesign to Excel
- Why AppleScript doesn’t work anymore when run from the batch processor?
