Skip to main content
aanavaras
Inspiring
June 17, 2013
Question

Index markers misplaced

  • June 17, 2013
  • 1 reply
  • 2430 views

Hi All,

I have a strange issue..."Index markers are misplaced"...please help me on this.

My need is to find keywords  with a specific ParagraphStyle and to add index for it.

So, i wrote script to findGrep the specified pStyle, loop through them and added index topic.

But unfortunately, index markers are not placed at the founded text (places somewhere else)

please help me to solve this issue.

Thanks

SaRaVaNaN.N

This topic has been closed for replies.

1 reply

Legend
June 17, 2013

Hello,

Try adding the index markers in reverse order.

There is a free script here, that might do what you want.

http://www.kerntiff.co.uk/products-4-indesign/indexers-corner/kps-index-utilities/quickindex

P.

aanavaras
aanavarasAuthor
Inspiring
June 22, 2013

Hi Pickory,

Thanks for your responce and the Link.

While i face this at the first time, i changed to reverse order, but it doesn't became a solution for me.

I have tested with the Script provided from given Link and the issue is still exists.

Below is my Script:

    var myDoc = app.activeDocument;

    app.findGrepPreferences.appliedParagraphStyle = "H2";

    app.findGrepPreferences.findWhat  = "^.+\\([A-Z]\\)$";     // REGEX TO MATCH THE EXACT INDEX ENTRY

    var myFinds = myDoc.findGrep();

    for (i=myFinds.length-1; i>=0; i--)

    {

        var myTxt = myFinds.contents;

        var myTopic = myDoc.indexes[0].topics.add(myTxt).pageReferences.add(myFinds);

    }

    alert("Index Generated Successfully.!");

Legend
June 23, 2013

I think your findWhat is wrong. Did you really want to whole para to be your index entry? This grabs upto the first ten characters.

    app.findGrepPreferences.findWhat  = "^([A-Z]).{0,10}"; 

I assumed you only wanted paras that start with uppercase alphas, hence the [A-Z] in your original findWhat.

P.