0 Replies Latest reply on Nov 6, 2015 12:53 PM by titoh86292909

    Script about Dynamic Bookmarks (Parent/Children)

    titoh86292909

      Hello!

       

      I'm writing one script for dynamic bookmarks with Javascript into InDesing, I'm saying to InDesign that when found an "@", will create a Bookmark with the word before of the caracter.

      But I need to write a code that will do "Parent" to the first bookmark, and "Children" to all the consecutives bookmarks.

       

      Do you know how to solve this?

      Here is my code:

       

      for(myCounter = 0; myCounter < app.activeDocument.stories.length; myCounter++){  
          myStory = app.activeDocument.stories.item(myCounter);  
          var dato = myStory.paragraphs[0];  
          var valDato = dato.contents;  
          var pDato = valDato.substring(valDato.length-1, valDato.length);  
          if (pDato=="@") {  
            var h = app.activeDocument.hyperlinkTextDestinations.add(myStory.paragraphs[0]);  
            var bm = document.bookmarks.add(h);  
            bm.name = valDato.substring(0,valDato.length-1);  
          }  
      }  
      

       

      Thanks,

      Bert.