Site logo

Relink images

Script for the batch processor version 4.4 or later. Alternatively, you can run it directly from InDesign as a regular script.

This script batch-relinks images according to the list defined either in the arguments file

…or in the array defined in the script itself.

Before

After

With the all open documents option selected, make sure to use g.doc variable to send the current document from the batch processor to this script otherwise, it will not work correctly. With all other options, you can alternatively use app.activeDocument or app.documents[0].

Code explanation: if the script is called from the batch processor and the g.doc variable is sent from it, the doc variable is set to g.doc. If something goes wrong, though it’s hardly possible, an error message is written to the log: "ERROR: 'g.doc == null' - Failed to get the document to process."
If the script is run as a regular one — from the Scripts panel or ESTK — the doc variable is set to the current document.
If the arguments file isn’t provided, or the script is run directly from InDesign, the hardcoded list array is used instead. The former is a better approach since you can edit the list in the text file and don’t have to mess up with the script itself.

Click here to download the script (plus the sample arguments file), and here are the test files I used for debugging (see the screenshots above).

Back to the main Batch processor page