2 Replies Latest reply on Jan 29, 2014 5:14 PM by MarineBoing

    Search and Remove Subordinate Bookmarks

    MarineBoing

      First off, I'd like to say that I have been trying to figure this out for the the past 2 weeks. This is my last resort.

       

      What I'm trying to do:

       

      -Search bookmarks to find any bookmarks that contain "Page"

      -Put those bm's into an array, to be deleted

      -Delete the array that was created.

       

      Example of BM:

       

      Decisions

       

            1A: Decision (01/01/2010)

                   Page 1

                  Page 2

                  Page 3

                  Page 4

       

      ((Same way through 10A:))

       

      Transfers

       

            1B: Transferred (07/26/2010)

                  Page 1

                  Page 2

                  Page 3

                  Page 4

       

      ((And so on for multiple pages and Bookmarks))

       

       

      This is the script I have, but keep getting errors on:

       

       

       

      var bm=searchBookmarks(this.bookmarkRoot, 1, "Page");

      console.println("End" + this.bookmarkRoot.name);

      //bm.execute();

      function searchBookmarks(bm, nLevel+, bmName)

      {

      if (bm = null) return null;

       

       

      if (bm.name = bmName)

      {

      console.println("Set: " + bm.name);

      bm.remove();

      return null;

      }

      if (bm.children != null)

      console.println("Trash: " + bm.children.length);

      var s=""

      for (var i = 0; i < nLevel; i+++) s += " ";

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

      var BmToDel = "Page" //bm to delete

      var arr = new Array(0);

      var bm;

      RemoveBookmarks(this.bookmarkRoot);

      while (bm = arr.pop()) bm.remove();

      function RemoveBookmarks(bm)

      {

      if (bm.children != null)

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

      RemoveBookmarks(bm.children[i+]);

      if (bm.name = BmToDel) { arr.push(bm); };

      }

       

       

      The error I keep running into is shown below. I have to be blind to keep missing the ")"

       

      SyntaxError: missing ) after formal parameters

      4:Console:Exec

      undefined

       

      Can someone please assist me in this script? It's driving me crazy.