Links Move Unused

JavaScript for Adobe InDesign
Latest update 6/24/2019, version 2.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
Links Move Unused screen
Download
Links Move Unused

You decide. Reward the author an
amount the solution is worth to you.

Instructions for use

The interface has three sections: Process, Links folder, and Destination folder. When the OK button is clicked, processing begins.

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.

The value defaults to the folder named “Links” that exists alongside the selected document or documents, as is typical for InDesign. Click the button Folder… and navigate to any other desired folder.

Section 3: Destination folder

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

When a link can’t be moved

When a link cannot be moved, rather than alert the user and halt processing (prior behavior), 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 two specific circumstances: 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 file name 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 file name.

Localization

The script provides user-configurable localization. By default the script language is US English, which does not require further download or configuration. For other languages, download the Language Pack and copy the i18n file for the desired language to the script folder alongside the script file. When launched, the script detects the i18n file and the interface displays the language. If the desired language is not present in the language pack, edit the English i18n file to translate to the desired language, and copy the edited i18n file to the script folder alongside the script file. For details of how to edit and install i18n files, read How to Localize Scripts.

Download
Links Move Unused

License details included in download

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

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

CHANGE LOG

Version 2.0 (190624)

  1. Revise logging.
  2. Restore altered app preferences on completion.
  3. Miscellaneous.

Version 19.3.8 (1.6.3)

  1. Add license.

Version 19.2.24 (1.6.2)

  1. Miscellaneous.

Version 19.2.23 (1.6.1)

  1. Update internationalization.

Version 19.2.21 (1.6)

  1. If any exist, load first .i18n discovered.
  2. Add language key at top of i18n data.

Version 19.2.17 (1.5)

  1. Log failure to move link rather than alert.
  2. Internationalization.
  3. Miscellaneous.

Version 18.12.8 (1.4.3)

  1. Fix typo "error has occured."
  2. Miscellaneous.

Version 18.11.6 (1.4.2)

  1. Process book limit to .indb extension.
  2. Fix flaw in process folder click handler.

Version 18.9.26 (1.4.1)

  1. Miscellaneous.

Version 18.8.19 (1.4)

  1. Report and skip moving file names with extended characters that otherwise throw an unhandled exception when Applescript called.

Version 18.7.17 (1.3)

  1. Wrap work in process function, wrapped in try/catch.
  2. Miscellaneous.

Version 18.5.15 (1.2)

  1. Remove close button from progress bar.
  2. Catch processing errors and alert user.

Version 18.4.9 (1.1)

  1. Revise progress window.
  2. Fix bug that causes converted documents to disable active document option.