Running Acrobat XI Pro on Win7 pc.
I want test all Bookmarks in a pdf file for ones that are named (for sake of this discussion), "xxx", and then rename them to "yyy".
My code starts at top of visible tree, var bm = this.bookmarkRoot.children; // Ignoring hidden bookmark, "Root".
It works here, but code will not iterate to that bookmark's children. And I need to go another level in after that.
How to get the code to test additional [visible] levels of bookmark tree? Hoping not to presume upon any of you for help, and having removed many lines that print to console for tracking/debugging, here is my code.
// Set start point to top of visible Tree (Ignoring "Root")
var bm = this.bookmarkRoot.children;
// Number of BMs in current tree level. Any of these could also have
// Children I also want to rename, but cannot seem to get to with Code.
var nChildNum = this.bookmarkRoot.children.children.length;
// Bookmark level in Tree. Could be 1, since I am ignoring the "Root"?
var nLevel = 0;
//** Use of nLevel is where I'm stuck. I think. It's commented out here because
// it's not working while it's active.
// for (var i = 0; i < nLevel; i++)
for (var j = 0; j <= nChildNum; j++) //** Using a counters and print to console, I can see that
// j increments, but code keeps testing var bm.
// Am not sure I even need this next line. It comes from
// Code I've found online.
if (bm.children != null)
if (bm.name == "xxxx")
bm.name = "yyyy";