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

how to avoid index repeated page numbers

Contributor ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

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

Views

907

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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>

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

index.png

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

hurix@123  wrote

index.png

Interesting…

hurix@123 , what is your version of InDesign?

Regards,
Uwe

Votes

Translate

Translate

Report

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
New Here ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
New Here ,
Jul 19, 2022 Jul 19, 2022

Copy link to clipboard

Copied

LATEST

Ah of course! Thanks Peter.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Yes,

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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