Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to avoid index repeated page numbers

Contributor ,
Mar 15, 2018 Mar 15, 2018

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.

TOPICS
Scripting
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2018 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 15, 2018 Mar 15, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

hurix@123  wrote

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

Do you mean you are not using InDesign's own Index generator? Then you can adjust that script. When it gathered all page references and you are about to write them out as an index, check if the next number you are outputting is the same as the previous.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 16, 2018 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 16, 2018 Mar 16, 2018

index.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

hurix@123  wrote

index.png

Interesting…

hurix@123 , what is your version of InDesign?

Regards,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 18, 2022 Jul 18, 2022

Hi Uwe, I'm having the same issue. Using 2022. Do you know if there's a fix?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 19, 2022 Jul 19, 2022

The Index panel shows all instances, so if there are two or more instances on a page you'll see them all in the panel. But when the index is generated only one instance is printed. Generate the index and see for yourself.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 19, 2022 Jul 19, 2022
LATEST

Ah of course! Thanks Peter.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 16, 2018 Mar 16, 2018

Yes,

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines