Links Move Unused

Script for Adobe InDesign
Latest update 12/17/2023, version 4.0

The script is a housekeeping tool. Some of my projects are photo books with many images or similar documents with many placed graphics. These jobs often begin with, or accumulate during development, far more images than ultimately appear in the final product. When the project is done, I like to organize my files. It is possible to package the document and produce a links folder that contains the graphics placed in the document, but what about graphics not used? I don't want to throw them out, and they are still blended with the graphics that are used, within the working links folder. So I made this script to pull out unused graphics and put them into a separate “Links not used” folder.

  • Moves graphic files not used to a selected folder
  • Examines graphics placed in the active document, a book file, or a folder of documents
  • Works with Mac and Windows
  • Uses system to move files, rather than copy and delete
  • All properties of moved files are preserved (modification time, etc.)
  • Also moves matching dotbar files on servers that split Mac resource and data forks
  • User-configurable localization
Download
Links Move Unused
Help me keep making new scripts by supporting my work. Click the PayPal button to contribute any amount you choose. Thank you. William Campbell

How-to Video

How to use the script

The interface has three sections: Process, Links folder, and Destination folder. Set options as desired and click the OK button to begin processing.

Section 1: Process

Active Document — examines graphics placed in the document that is currently open and the top-most window if multiple documents are open.

Book — select an InDesign book file and graphics placed in all documents the book file references are examined.

Folder — select a folder and graphics placed in all InDesign documents in the folder are examined. Only files with the .indd extension are processed.

Section 2: Links folder

Select the folder to examine and compare against the graphics placed in the active document, selected book file, or selected folder of documents. This examination determines which files are referenced by the selected document or documents, and which files have no reference appearing in any of the documents. Files that lack any reference are moved to the Destination folder, defined below.

The default is a folder named “Links” that typically exists alongside the selected document or documents. Click the button Folder… and navigate to any other desired folder, if for example the project’s links are stored elsewhere (or in multiple folders; see below Multiple links folders). Selecting a folder other than default also updates the Destination Folder to match the same name plus “ not used”.

Section 3: Destination folder

The folder to which unused links are moved. The default is a folder named “Links not used” in the same folder containing the selected document or documents, alongside the selected links folder. If the folder does not exist, it is created. Click the button Folder… and navigate to, or create, any other desired folder.

The script recognizes subfolders within the links folder and duplicates the subfolder structure within the destination folder.

Multiple links folders

During project development, it is not uncommon for links to be organized in separate folders, for example chapters or sections of a book. Ultimately these will likely be consolidated into a single links folder, but not until design is complete. The script still works in these cases, only it requires running the script on each separate links folder. This is possible because the script does not consider what is missing in the folder, rather what is in the folder but missing from the document(s). There is no harm in using the script this way. For each links folder processed, a matching folder of its name plus “not used” is created, matching any subfolder structure in the links folder.

When a link can’t be moved

When a link cannot be moved, rather than alert the user and halt processing, the failure is written to a log file at the location of the active document or book, or the location chosen when processing a folder. If such a failure occurs, when processing is complete the user is notified of the logging. The user is then instructed to resolve the unused links manually.

Failure to move a file could be due to a general error, or: 1. if a particular link is unused, but already exists in the destination folder, it will not be moved (to prevent overwriting). 2. on MacOS, the script calls AppleScript to move the file, which fails if the filename contains Unicode characters (extended characters such as accents, etc.). This is not a flaw of AppleScript, which handles Unicode fine, rather a flaw in how Adobe ExtendScript communicates with AppleScript. Windows uses VBScript and has no problem moving files with Unicode characters in the filename.

Important note for Windows users

If you receive the error “Unable to load Adobe InDesign Type Library”, you must exit InDesign and Run as administrator to load needed libraries that non-administrators cannot because they lack permission to alter the system. Exit InDesign then open the Windows Start Menu. Locate InDesign and right-click, select “More”, then “Run as administrator”. Launch the script and the needed libraries are automatically loaded. These steps are only required once. After the libraries are loaded, running as administrator is no longer necessary.

Language

By default the script language is US English, which does not require further download or configuration. To have the script interface display other languages, choose from the available languages below. Download and copy the .i18n file to the script folder alongside the script. When launched, the script detects the language file and displays interface text in that language. If your language is not listed, download the English file and translate it. The file is plain text formatted as JSON, containing interface text in English, and a second value for its translation, which for the English file is the identical text. Copy the file and rename it to replace “en” with the relevant code for your language, then edit the file to change each line’s second value to the translation in your language. For more detailed instructions of how to edit and install i18n files, see How to Localize Scripts.

English: links-move-unused-en-i18n.zip

Spanish: links-move-unused-es-i18n.zip

Help me keep making new scripts by supporting my work. Click the PayPal button to contribute any amount you choose. Thank you. William Campbell
Download
Links Move Unused

Change log: links-move-unused.txt

For help installing scripts, see How to Install and Use Scripts in Adobe Creative Cloud Applications.

IMPORTANT: scripts are developed for the latest Adobe Creative Cloud applications. Many scripts work in CC 2018 and later, even some as far back as CS6, but may not perform as expected, or run at all, when used in versions prior to 2018. Photoshop features Select Subject and Preserve Details 2.0 definitely fail prior to CC 2018 (version 19) as the features do not exist in earlier versions. For best results use the latest versions of Adobe Creative Cloud applications.

IMPORTANT: by downloading any of the scripts on this page you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.

IMPORTANT: fees paid for software products are the purchase of a non-exclusive license to use the software product and do not grant the purchaser any degree of ownership of the software code. Author of the intellectual property and copyright holder William Campbell retains 100% ownership of all code used in all software products regardless of the inspiration for the software product design or functionality.