Create index topics from character styles

The script creates topics for and page references to all text formatted with certain character styles. Select any character styles in the script's dialog. Optionally prefix the character style's name to the topic. Choose to replace an existing index or to add new topics and page references to an existing index.

Use

The script shows this dialog:

[image: index from character styles 1]

Select any character styles from the list in the usual way. Check Replace existing index to delete all existing topics and page references. Tick Prefix style name to topic to add the name of the character style to the topic (only to the topic, naturally, not in the text). Indexing text formatted with the character styles cat and dog and prefixing the style names to the topics would result in an index like this:

[image: index panel]

All dogs are grouped together, as are all cats. After you've generated the index these prefixes can be deleted with a simple GREP find and replace:

Find what: ^.+#

Replace with: <leave empty>

Style groups

The script shows style groups and styles on one line. Groups and styles are separated by a >:

[image: index from character styles 2]

Styles can be selected in the usual way.

Show script (right click, Save Link/Target As to download)

Installing and running scripts

Back to the main page on indexing

Editing a script

Questions, comments? Get in touch