Skip to main content
hurix
Inspiring
March 15, 2018
Question

how to avoid index repeated page numbers

  • March 15, 2018
  • 5 replies
  • 1823 views

founds = app.documents[0].findGrep();

    for (i =0 ; i<founds.length; i++) {

    found = founds;

    app.select(found);

    myTopic.pageReferences.add(found, PageReferenceType.currentPage );

}

If Index term repeatedly found in the same page number need to skip that or have to give range.

This topic has been closed for replies.

5 replies

hurix
hurixAuthor
Inspiring
March 16, 2018

Yes,

Peter Kahrel
Community Expert
Community Expert
March 16, 2018

I have never seen that, and I've done a fair number of indexes with InDesign. Bizarre.

hurix
hurixAuthor
Inspiring
March 16, 2018

Peter Kahrel
Community Expert
Community Expert
March 16, 2018

Do you seriously mean that when you generate the index the result is

A...Ca, xi, 137, 137, 137, 137, 138 etc?

hurix
hurixAuthor
Inspiring
March 16, 2018

Sorry for confusing

After generated index from index palate this grep will wo

I have some index terms in index.txt file, my script will do all the index term automation placed into in InDesign index palate.

hurix
hurixAuthor
Inspiring
March 16, 2018

for example:

Index term is  - rama krishna

rama krishna  appearing 4 times  in single page (example page number 10), then my script writing like

rama krishna ,  10, 10, 10, 10

Peter Kahrel
Community Expert
Community Expert
March 16, 2018

If your index term is 'rama krishna' and you add four page references on page 10, then InDesign's generated index should have just one reference to page 10. I've no idea how you get those four references to p. 10 in your index. Anyway, you can remove them in the generated index with a GREP replacement, something like

Find what:  (, \d+)\K\1+

Replace with: <leave field empty>

Peter Kahrel
Community Expert
Community Expert
March 15, 2018

If you add more than one pageReference to a page, that page's number will appear in the generated index only once. No need to skip anything.

What you mean by 'or give range' isn't clear in this context.