16 Replies Latest reply on Jul 28, 2013 10:53 AM by Pickory

    Index markers misplaced

    aanavaras

      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

        • 1. Re: Index markers misplaced
          Pickory Level 3

          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/quickind ex

           

          P.

          • 2. Re: Index markers misplaced
            aanavaras Level 1

            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[i].contents;

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

                }

                alert("Index Generated Successfully.!");

            • 3. Re: Index markers misplaced
              Pickory Level 3

              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.

              • 4. Re: Index markers misplaced
                aanavaras Level 1

                Hi Pickory,

                 

                i need the whole para with paragraphStyle 'H2' and with the pattern of some text ends with paranthesised uppercase character.

                in my document, this syntax will matches the exact index term (para will contain less than 20 chars).

                is there any limitations in char length of an topic name? i dont think so... while i add the same by manual, it works great...

                 

                please let me know your valuable comments.

                 

                –SaRaVaNaN.N

                • 6. Re: Index markers misplaced
                  [Jongware] Most Valuable Participant

                  Pickory wrote:

                   

                  Try this.

                   

                  app.findGrepPreferences.findWhat  = "^.+\r";

                   

                  That does not work -- and you don't really want a hard return in your index entry. The problem lies not in A.s GREP or in the order of adding the topics. I get the same mismatch if -- and only if! -- the index entries are inserted after a table.

                   

                  It seems tables mess up the internal indexing real good. I tried some variants but they all failed, and all of them worked correctly if I removed the table.

                  1 person found this helpful
                  • 7. Re: Index markers misplaced
                    Pickory Level 3

                    Ooops, ID was kind enough to strip the hard return off when the index entry was inserted.

                     

                    It seems to be off by multiple of 3 characters.

                     

                    P.

                    • 8. Re: Index markers misplaced
                      Laubender Adobe Community Professional & MVP

                      @all – what InDesign version do we talk here? What OS?

                      ( just for testing reasons )

                       

                      Uwe

                      • 9. Re: Index markers misplaced
                        Pickory Level 3

                        Hello,

                         

                        I am Mac 10.6.8, ID 6.

                         

                        There does seem to be a fix here.

                         

                        http://www.hilfdirselbst.ch/foren/Script_f%FCr_Index_in_InDesign_CS5_P449901.html

                         

                        edit

                        That trick works for up to two tables. You could put it a loop.

                         

                        P.

                        1 person found this helpful
                        • 10. Re: Index markers misplaced
                          Laubender Adobe Community Professional & MVP

                          Thanks, Pickory!
                          I had vague memories about this post on hilfdirselbst.ch.

                           

                          Uwe

                          • 11. Re: Index markers misplaced
                            Laubender Adobe Community Professional & MVP

                            Just adding: also important not to forget to add an index to the document, if there is no index present:

                             

                             if (myDoc.indexes.length == 0)      
                             myDoc.indexes.add();
                            

                             

                            Another thing; interesting but not so important:

                            I just searched the DOM documentation and it seems, that one cannot remove an Index from a document:

                             

                            myDoc.indexes[0].remove();
                            

                             

                            cannot work, because there is no remove() method for indexes.

                            Just an omission?

                             

                             

                            Uwe

                            • 12. Re: Index markers misplaced
                              aanavaras Level 1

                              Hi All,

                               

                              Thanks for all your comments/suggestions.

                               

                              Pickory - my Grep wont search for carriage returns (i grepped only upto end of line)

                                             FYI: my grep works fine and the terms i founded were perfect, my only issue is the index markers are misplaced.

                                             the link you provided "hilfdirselbst.ch" is not connecting for me.

                               

                              Jongware - my document not containing any tables. just having 5 floating textboxes - will this matter?

                                             and i tried in both orders to 1-to-n and n-to-1, but still the issue exists.

                               

                              Laubender - I'm using ID 5.5 in Win7

                               

                              i'm still struggling in various methods to find a solution for this...

                              • 13. Re: Index markers misplaced
                                Laubender Adobe Community Professional & MVP

                                Unfortunately www.hilfdirselbst.ch seems to be down right now.
                                Possibly for maintenance.
                                Shouldn't last more than a few hours…

                                 

                                Back to the problem:
                                With a first quick test in InDesign CS5.5 I cannot confirm Jongware's finding about tables.
                                But that should not mean, it's not a possible issue: therefore the bug fix in the script at hilfdirselbst.ch.

                                 

                                I will test on with a more complex document.
                                Maybe it has to do with the number of pages or sections involved (I know, a wild guess)…

                                 

                                Btw., your code was running nearly* fine with my singular test.
                                I changed it slightly to grab all contents of all paragraph named "H2" to make it easier to build a  document for testing.

                                 

                                *I just had to add an index to the document with the snippet in answer #11 here.
                                (There wasn't any from the start.)

                                 

                                Can you provide a test document somewhere to download?

                                 

                                Uwe

                                • 14. Re: Index markers misplaced
                                  Peter Kahrel Adobe Community Professional & MVP

                                  I can confirm Jongware's observation about tables. The more tables in a story, the bigger the distance between the spot where you wanted the marker and the spot where it actually lands. The size of the table matters too: the more rows in a table, the bigger the misplacement.

                                   

                                  Aanavaras: I too would be interested to see your document, as I thought that tables would be the only culprit.

                                   

                                  Peter

                                  1 person found this helpful
                                  • 15. Re: Index markers misplaced
                                    aanavaras Level 1

                                    Thanks Guys.

                                     

                                    Yes Peter Kahrel, the culprits are only the Tables.

                                    Since the Textboxes has resized and the tables were hidden inside of it, I couldn't find the tables.

                                    Sorry for the confusion.

                                     

                                    For tesing purpose, i removed all tables and checked... "My Script works Great.!"

                                     

                                    Laubender & Pickory: now the site is connecting. will check the script and get back with the result.

                                    • 16. Re: Index markers misplaced
                                      Pickory Level 3

                                      Hello,

                                       

                                      This gets even worse. Inserting index markers can alter the pagination / text flow.

                                       

                                      P.