Copy link to clipboard
Copied
I want to search for index markers and figure out what topics the markers correspond to.
I need to do this in sequential order (in the order the index markers appear in the text).
Is there a way to do this in script?
Dim myInDesign As InDesign.Application
myInDesign = CreateObject("InDesign.Application")
myInDesign.FindGrepPreferences = InDesign.idNothingEnum.idNothing
myInDesign.ChangeGrepPreferences = InDesign.idNothingEnum.idNothing
myInDesign.FindGrepPreferences.FindWhat = "~I"
Dim myDocument As InDesign.Document
myDocument = myInDesign.ActiveDocument
myFound = myDocument.FindGrep()
For iFound = 1 To myFound.Count Step 1
' myTopic = myFound(iFound).Topic.Name <---- Here
Next
Thanks.
Tak
Hi Tak,
yes there is a method to do it:
The first insertion point of a found index marker is exactly the source text of a page reference of a topic.
So you could loop the allTopics array ( if that exists in your used language ) of the index in your document:
For every topic with page references: Loop the page references collection and compare sourceText with the first insertion point of your found index marker.
Sorry, but I cannot give you any code with your scripting language, I'm just an E
...Copy link to clipboard
Copied
Hi Tak,
yes there is a method to do it:
The first insertion point of a found index marker is exactly the source text of a page reference of a topic.
So you could loop the allTopics array ( if that exists in your used language ) of the index in your document:
For every topic with page references: Loop the page references collection and compare sourceText with the first insertion point of your found index marker.
Sorry, but I cannot give you any code with your scripting language, I'm just an ExtendScript writer.
So allTopics and sourceText may or may not exist with that wording in your language.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe,
That makes sense. allTopics is available so I should be able to code it.
Thank you for your explanation.
Regards,
Tak