2 Replies Latest reply on Oct 26, 2016 10:29 AM by Laubender

    Apply bookmark based on paragraph style

    jakec88782761 Level 2

      This script works if I manually type what the .contents should be. But it fails to do anything if I try and create a bookmark based on the applied paragraph style.

       

      paras[p] stores all the paragraphs in the document and loops through them.

       

         if ( paras[p].contents.appliedParagraphStyle === "Heading 1" ) {

                          

                           var a = app.activeDocument.hyperlinkTextDestinations.add( paras[p] ); 

                          var bm = app.activeDocument.bookmarks.add( a );

                          bm.name = paras[p].contents;

                     

                    }

       

      Does anyone have any advice?