Skip to main content
Participant
Mar 20, 2013 12:27 PM UTC
Answered

Please help. How to remove some of index reference?

Sometimes I need to use an old indesign document to make another book. It is easy and fast. You do not need to define footnotes, running headers, master pages etc. 

I always have the problem with books that had index inside.

It is easy to remove an old text from the document and fill in a new text.

But if an old document had index, such reference like "see" "see also" etc. still remains unremoved (undeleted). 

The are stil listed in the index palette. 

And I don't know how can I remove them automatically from my old document before I import a new text to it.

Probably someone of you can write such simple script which can remove all index reference (or particularly such as "see" and see also") from the empty InDesign document.

I mean empty indesign document that is document without body text inside.

Thank you in advance for your help and sorry for my poor English.

This topic is closed to new replies. Start a new post to keep the conversation going.
Peter Kahrel
Peter KahrelCorrect answer
Community Expert
Mar 20, 2013 5:09 PM UTC

try {

    app.activeDocument.indexes[0].topics.everyItem().remove();

} catch (_) {

}

14 replies

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
Mar 20, 2013 5:09 PM UTC

try {

    app.activeDocument.indexes[0].topics.everyItem().remove();

} catch (_) {

}

Translate
Inspiring
Feb 20, 2014 6:51 AM UTC
app.activeDocument.indexes[0].topics.everyItem().remove();

works very well to remove() every topic – at the first level.

But how to remove a topic at the second level (subtopic).

With the following code I fail to remove a subtopic.

#target InDesign

main();

function main()

{

          var _index = (app.documents.firstItem().indexes.length > 0) ? app.documents.firstItem().indexes.firstItem() : app.documents.firstItem().indexes.add();

          _index.topics.add({name:'topic'});

          _index.topics.itemByName('topic').topics.add({name:'subtopic'});

          if (_index.topics.itemByName('topic').topics.itemByName('subtopic').isValid)

          try

          {

                    // no success

                    _index.topics.itemByName('topic').topics.itemByName('subtopic').remove();

//~                     _index.topics.firstItem().topics.firstItem().remove();

//~                     _index.topics.firstItem().topics.everyItem().remove();

                    // success

//~                     _index.topics.everyItem().remove();

//~                     _index.topics.itemByName('topic').remove();

          }

          catch(e)

          {

                    alert( e);

          }

}

How to remove 'unused' subtopics (such with no topics and no references) only?

Martin

Translate
Inspiring
Feb 20, 2014 9:46 AM UTC

Hi Martin,

I'm afraid it's an old (mis)known issue: http://forums.adobe.com/message/3832867#3832867

@+

Marc


Hi Marc, 

thank you.

So we will have to live with all those dead (sub)topics. 

Martin

Translate