How can I create a script to automate the process of indexing all text with a specific paragraph style from the beginning of the document to the end?
how would you do it with the UI of InDesign?
Give a step by step description.
There are already some scripts around for indexing specially formatted text.
See Peter Kahrel's blog and list of scripts here:
Also look perhaps into this:
I'm not sure, what you want exactly to do.
Do you want a ordered list of contents of paragraphs formatted with a special paragraph style plus the page name in front of it? Something like this:
33 Contents of paragraph found with all formatting
35 Contents of paragraph found with all formatting
122 Contents of paragraph found with all formatting