2 Replies Latest reply on Sep 12, 2011 7:07 PM by JoFrmOZ

    Move all Sub Bookmarks up a Level on the Bookmark Tree

    JoFrmOZ Level 1

      I have a report which has a main bookmark and 180 sub bookmarks.

       

      I need a to move all of the sub marks and their links up a level then remove the first main bookmark.

       

      I have created a script which will remove the top most bookmark at the finish, but need help in how the sub bookmarks can be moved up a level).

       

      if (this.bookmarkRoot.children!=null)

      for (var i=0; i < this.bookmarkRoot.children.length; i++)
      {

       

      \\ Move bookmarks up a level here?

       

      \\ Remove topmost bookmark

      var bm = bookmarkRoot.children[0];
      bm.remove();
      }

      Any assistance will be most appreciated - thank you.

        • 1. Re: Move all Sub Bookmarks up a Level on the Bookmark Tree
          try67 MVP & Adobe Community Professional

          Read the documentation of the Bookmark's method insertChild().

          • 2. Re: Move all Sub Bookmarks up a Level on the Bookmark Tree
            JoFrmOZ Level 1

            Thank you for your advice.

             

            Script to move all sub bookmarks as follows:

             

            for (var i=0; i < this.bookmarkRoot.children.length; i++)

            if (this.bookmarkRoot.children[i].children!=null)

            for (var j=this.bookmarkRoot.children[i].children.length-1; j >= 0; j--)

            {

             

            var bm = bookmarkRoot.children[i].children[j];

            bookmarkRoot.insertChild(bm, bookmarkRoot.children.length);

            }

            The bookmarks have moved up a level, but are in descending order instead of ascending order.

             

            The bookmarks which have moved also have sub bookmarks associated with them which have not been moved up.

             

            Can you please advise how to move the bookmarks in ascending order and how to move the sub bookmarks associated with the bookmarks which have been moved?

             

            Thank you.