15 Replies Latest reply on Jul 4, 2013 6:57 AM by GJ du Toit

    Deleting Index Topics

    GJ du Toit

      I based a new document on an existing document with index markers and index cross-references.

      In the new document there are no index markers, but the topics and cross-references from the old document are still there. These are not deleted (as expected) by "Remove unused topics". I tried to delete them one by one, starting at the top. This works, albeit slowly, but InDesign crashes often while doing it. The crashes seem to come when I try to delete See and See also references whose referenced topics have been previously deleted. I can't find a way of getting past this, and I don't want these cross-references in this book—they're irrelevant here.

      Any suggestions?

        • 1. Re: Deleting Index Topics
          Pickory Level 3

          Hello,

           

          You could try this script.

           

          //1. Peter Kahrel, Mar 20, 2013 10:09 AM   in reply to olfar

          try {

              aDoc.indexes[0].topics.everyItem().remove();

          } catch (_) {

           

          }

           

          P.

          • 2. Re: Deleting Index Topics
            GJ du Toit Level 1

            Thanks. That seems to be what I need, but it doesn't seem to do anything. I saved it as .jsx and put it in my ID scripts folder, but when I run it, nothing happens. Am I doing something wrong?

            • 3. Re: Deleting Index Topics
              Pickory Level 3

              oops, sorry, replace aDoc with app.documents[0]

               

              edit to say.

               

              Now I am miss quoting. This is what I should have siad in the first place.

               

              try {

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

              } catch (_) {

              }

               

              http://forums.adobe.com/message/5164126#5164126

               

              P.

              • 4. Re: Deleting Index Topics
                GJ du Toit Level 1

                Ah, I think that works, but it crashes InDesign, probably because it deletes those topics that crash ID when deleted manually. However, as a clumsy workaround I generated an index consisting of the topics that couldn't be deleted, and saved that so that I can remove those entries from the final index (in the end, there were only six).

                These are malformed entries. They all have the form "Company, see" or  "Company, see also", with no further reference. They can't be deleted (ID crashes), nor can they be edited: I inserted a topic with an actual marker in the text and tried to make them refer to that, but when I click OK the cross-reference remains unchanged. Seems this document is stuck with those forever.

                But thanks for your help. I think the script will come in handy some time.

                • 5. Re: Deleting Index Topics
                  Pickory Level 3

                  Hello,

                   

                  I would be tempted to save the file to IDML and reopen it.

                   

                  P.

                  • 6. Re: Deleting Index Topics
                    GJ du Toit Level 1

                    That struck me as a good idea. But ID crashes when I do that too. Probably caused by the same bad index topics?

                    • 7. Re: Deleting Index Topics
                      Pickory Level 3

                      If you can share the document, I would be happy to have a go.

                       

                      P.

                      • 8. Re: Deleting Index Topics
                        GJ du Toit Level 1

                        Thanks, that's kind of you. Please don't waste any time on it, the problem has become mostly academic. Only four problem entries remain (I've since added a whole lot of additional entries, for the current text):

                        Company

                            foreign See

                        Foreign company See also

                        MOI See

                        NPC See

                         

                        But I'll be interested to know what you make of those entries. The document is available at:

                        https://dl.dropboxusercontent.com/u/9069705/Consumer%20Law%20Unlocked%20Folder.zip

                        • 9. Re: Deleting Index Topics
                          Pickory Level 3

                          Hello,

                           

                          Well, ID6 Mac desktop crashes while trying to open the document. ID 6 Mac server can open the document and create a pdf but crashes if I try to delete the topics.

                           

                          Failed, sorry.

                           

                          P.

                          • 10. Re: Deleting Index Topics
                            Peter Spier Most Valuable Participant (Moderator)

                            You might try exporting the story(s) to ID tagged text and import them into a new file and see if that cleans things up.

                            • 11. Re: Deleting Index Topics
                              GJ du Toit Level 1

                              First I must stress that this isn't at all critical; hardly a problem at all, so please don't break you head and waste time over it (all I have are four bad index cross-references that I don't want and can't delete). Ortherwise the document is fine, and the new index is fine (I'll delete the unwanted cross-references after generating), and the document doesn't crash InDesign.

                               

                              I'm afraid exporting to tagged text won't help because the problem topics and cross-references aren't markers in the text. Page references exist as markers in the text, but topics without references, or with cross-references only, live elsewhere in the InDesign document, not as text markers.

                              • 12. Re: Deleting Index Topics
                                Peter Spier Most Valuable Participant (Moderator)

                                The point here is that if you can export to tagged text you should only get those things actually inthe text stream, and by importing into a new file you ought to be able to bypass any corruption still present in the old one. I understand it isn't critical this time, but it's a technique you might want to try to see if it has potential for the next time this happens when maybe you won't be as lucky.

                                • 13. Re: Deleting Index Topics
                                  Pickory Level 3

                                  Hello,

                                   

                                  I think I would try and rebuild the document.

                                   

                                  That said, I have a plugin that will remove all topics from an index, including this one.

                                   

                                  Would you like your topics zapped?

                                   

                                  edited to say, now I can't add any index entries, so I think the plugin is a bit dangerous!

                                   

                                  P.

                                  • 14. Re: Deleting Index Topics
                                    GJ du Toit Level 1

                                    Yes, you're quite right. If I exported to tagged text and reloaded the text into the same document, the index topics will still be there. But of course, after exporting to tagged text I should start a new document, import text styles and master pages from the troublesome document, and then import the tagged text. I've just tried that, and the topics are indeed gone. (But for now, I'm staying with the old one; I'm too lazy to do all the additional little things required to get the new document into shape!)

                                    Thanks for you input. What I'll remember in future is: when starting a new document to be based on an existing one with an embedded index,start a new document and import the styles rather than just save it under a new name, delete the text, and import the new text.

                                    We learn!

                                    • 15. Re: Deleting Index Topics
                                      GJ du Toit Level 1

                                      Oh dear . . . sounds like a plugin to avoid!