Function on a bookmark
How can I create these bookmarks into a structure that is Tools > No Color, Black (Ground), 032 (Red) (Battery Power) (Bookmark names under the Parent bookmark Tools). Then I also need to have it add a javascript to the bookmarks (ie No Color bookmark would run a function noColor();)
I found a tutorial I believe Thom Parker created on creating bookmarks....
but being fairly new to javascript in Acrobat I don't think I really understand what his function is doing.
var checkedOne = 0;
var checkedTwo = 0;
var checkedThree = 0;
var foundLayers = [];
var ocgArray = this.getOCGs();
for (var i = 0; i < ocgArray.length; i++) {
if (ocgArray.name == "No Color" && checkedOne == "0") {
foundLayers.push(ocgArray.name);
checkedOne++;
}
if (ocgArray.name == "Black (Ground)" && checkedTwo == "0") {
foundLayers.push(ocgArray.name);
checkedTwo++;
}
if (ocgArray.name == "032 (Red) (Battery Power)" && checkedThree == "0") {
foundLayers.push(ocgArray.name);
checkedThree++;
}
}
function MakeBkMks(oBkMkParent, aBkMks)
{
for(var i=0;i<aBkMks.length;i++)
{
if(typeof(aBkMks) == "string")
oBkMkParent.createChild({cName:aBkMks, nIndex:i});
else
{// Assume this is a sub Array
oBkMkParent.createChild({cName:aBkMks[0], nIndex:i});
MakeBkMks(oBkMkParent.children, aBkMks.slice(1) );
}
}
}
// Create the Bookmarks
MakeBkMks(this.bookmarkRoot, foundLayers)
