I'll try that. I was hoping to export from FrameMarker to get the chapters in the bookmarks instead of renaming the bookmarks in Acrobat.
Here is an Acrobat JavaScript. I will post a video link explaining how it works and how to use it.
if (app.viewerVersion >= 10) {
// Add a toolbutton for the command.
app.addToolButton ({cName: "NumberBookmarksCmd",
cTooltext: "Number Bookmarks",
cExec: "numberBookmarks();",
cEnable: "event.rc = (event.target != null);",
nPos: 0 });
}
else { // 9 or below.
// Add the Convert Bookmarks to Title Case menu item to the Document menu.
app.addMenuItem ({cName: "NumberBookmarksCmd",
cUser:"Number Bookmarks",
cParent: "Document",
cExec: "numberBookmarks();",
cEnable: "event.rc = (event.target != null);" });
}
// Make a global counter variable to count the bookmarks
// that should be numbered.
counter = 0;
function numberBookmarks () {
processBookmarks (this.bookmarkRoot);
}
function processBookmarks (bkm) {
var numberRegex = /^Body \- (.+)$/,
otherRegex = /^[^-]+ \- (.+)$/;
if (numberRegex.test (bkm.name) === true) {
counter += 1;
bkm.name = bkm.name.replace (numberRegex, "Ch " + counter + " $1");
}
else {
bkm.name = bkm.name.replace (otherRegex, "$1");
}
if (bkm.children != null) {
for (var i = 0; i < bkm.children.length; i++) {
processBookmarks (bkm.children[i]);
}
}
}