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.
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.
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
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>
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.
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Uwe, I'm having the same issue. Using 2022. Do you know if there's a fix?
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.
Copy link to clipboard
Copied
Ah of course! Thanks Peter.
Copy link to clipboard
Copied
Yes,
Copy link to clipboard
Copied
I have never seen that, and I've done a fair number of indexes with InDesign. Bizarre.