Skip to main content
Inspiring
April 19, 2013
Answered

Help on finding text and applying INDEX

  • April 19, 2013
  • 1 reply
  • 1027 views

Hi Forum,,

I m trying to apply INDEX to the founded words at a single click of the "UI button created".

Is that possible.

This is my try.

app.findGrepPreferences = app.changeGrepPreferences = null;

doc = app.activeDocument.stories.everyItem();

app.findGrepPreferences.findWhat = "Policy";

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

            for (i =0 ; i>found.length; i++) {

                //fnd = found;

                              if (found.length > 0)

            doc.indexes[0].topics.add(found);

            app.select[found];

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

}

thanks & regards,

rkids

This topic has been closed for replies.
Correct answer SureshRaji

Very thanks pickory a great help!...

I just want to share with forum to get a help.....

How can i find the way...... to find the text in "FIND WHAT" (eg.  all the "policy" word inside the document)  

and

replace with doc.pageReferences.add(found, PageReferenceType.currentPage );

I tried in many ways, its not working...

thanks & regards,

rkids.



Hi rajnikids,

I am new to javascript.

Try this

app.findGrepPreferences = app.changeGrepPreferences = null;

doc = app.activeDocument.stories.everyItem();

app.findGrepPreferences.findWhat = "Policy";                                                         // the text you want to find

myTopic = app.activeDocument.indexes.add().topics.add ({name: "Policy"});       // add topic

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

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

    found = founds;

    app.select(found);

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

}

1 reply

rajnikidsAuthor
Inspiring
April 19, 2013

ANY HELP on this FOrum..

Legend
April 19, 2013

The very generouse Peter has some samples here.

http://www.kahrel.plus.com/indesign/lists_indexes.html

P.

rajnikidsAuthor
Inspiring
April 20, 2013

Very thanks pickory a great help!...

I just want to share with forum to get a help.....

How can i find the way...... to find the text in "FIND WHAT" (eg.  all the "policy" word inside the document)  

and

replace with doc.pageReferences.add(found, PageReferenceType.currentPage );

I tried in many ways, its not working...

thanks & regards,

rkids.