Index: Add Page References to Imported Topics
When you import topics from another document, any page references aren't imported, naturally. The script adds these.
This script is part of the Indexes and Concordances collection. See the full collection here.ย
You can import into a document the topics from another document:

This imports just the topics, though, not any page references. The script adds page references to all topics.
Strict matching
The script looks for the literal topic text: whole-word only, case-sensitive, a character-by-character match. That means that the topic Bas-Armagnac gets page references to Bas-Armagnac, not to armagnac, Armagnac, or bas-armagnac.
Case-sensitivity can be changed by modifying line 7 of the script so that it reads
var case_sensitive = false;
Terminal and non-terminal topics
By default, the script adds page references only to terminal topics. That is to say parent topics are ignored, so that of the topic dogs and its subtopics:

only the terminal topics Border and Highland are referenced:

If all intermediate topics and the main topic need to be referenced as well so that the result is as follows:

then you need to change a setting in the script. Open the script and go to line 6. Change true to false so that the line reads:
var terminals_only = false;
Unused topics
After finding adding page references to the topics, the script collects all topics for which it couldn’t find any matches in the document and lists these unused topics in a new document.
Use
The script has no interface — just run it.
Peter Kahrel Script Repository
Hosted as a community service, and with deep appreciation, by CreativePro.com
Scripts by Topic | Script Index
Basic Script Installation and Use
How to Modify or Configure These Scripts
Resources for Scripting and Publishing Automation
About This Repository
Contact Peter Kahrel
Note to users: You run scripts at your own risk: CreativePro and the author accept no liability for anything that may be caused by any of these scripts. Always take the necessary precautions. We encourage you to save backups and test scripts on copies of your documents.
This article was last modified on August 22, 2026
This article was first published on November 3, 2025
Commenting is easier and faster when you're logged in!
Recommended for you
Going Deep with Footnotes
Whether you're explaining, referencing, or elaborating, footnotes and endnotes a...
How to Split Alternate Layouts to Individual Files in InDesign
Learn how to split alternate layouts in an InDesign file out to separate files u...
Managing InDesign Scripts
Using scripts in InDesign is one of the best ways to automate processes and spee...
