0 Replies Latest reply on Mar 30, 2015 7:05 AM by johnp45247251

    set bookmark level based on paragraph styles

    johnp45247251 Level 1

      Hi Guys,

      I am new to Applescript and indesign.

      I need to set bookmark level based on paragraph styles. Initially i am searching paragraph one by one in every stories.

      After that, first paragraph of applied paragraph styles is set in first bookmark(level 1)

      and then next paragraphs and so on.(these are set in first bookmarks followed by one by one).

      After that first paragraph of applied paragraph styles is comes then set second bookmark (level 1)

       

       

      My coding is shown in below.

      ----------------------------------------

       

      Here, BookMarkStyleName is the list of paragraph style name

       

      and BookMrkLevelNam is the list of level of bookmarks.

       

       

      tell application "Adobe InDesign CC 2014"

              tell active document

                  if (count of story) > 0 then

                      repeat with sto from 1 to count of story

                          tell story sto

                              if (count of paragraphs) > 0 then

                                  repeat with x from 1 to count of paragraphs

                                      set appParaName to name of applied paragraph style of paragraph x

                                      if appParaName is in BookMarkStyleName then

                                          select paragraph x

                                          my GotoBookmark(FulName, BookMrkLevelNam, BookMarkStyleName)

                                      end if

                                  end repeat

                              end if

                          end tell

                   end repeat

                end if

            end tell

      end tell

       

      on GotoBookmark(FulName, BookMrkLevelNam, BookMarkStyleName)

          tell application "Adobe InDesign CC 2014"

              set selItem to item 1 of selection

              set ObjRef to object reference of item 1 of selection

              set textdestinate to make hyperlink text destination of active document with properties {name:selItem, destination text:ObjRef}

              set Bkname to make new bookmark of active document with properties {indent:BookMrkLevelNam, destination:textdestinate}

          end tell

      end GotoBookmark

       

       

      Please Help me,

       

       

      Thanks by,

       

      John Peter.