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:

import topics

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-Armagnacnot to armagnacArmagnac, 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:

import topics

only the terminal topics Border and Highland are referenced:

import topics

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

import topics

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


Repository Home Page


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.

Bookmark
Please login to bookmark Close

This article was last modified on August 22, 2026

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...