Thanks Jang - in the meantime I had a similar idea, noting that in the menu.cfg files there both a FormatMenu and a BookFormatMenu exists. But even this does not help:
var menuLocation = app.GetNamedMenu("FormatMenu"); var bibenMenu = menuLocation.DefineAndAddMenu("!BIBENmain", (localize(menuMain))); bibenMenu.DefineAndAddCommand(1,"BibenDocu", (localize(menuDocu)), ""); menuLocation = app.GetNamedMenu("BookFormatMenu"); var bkbibenMenu = menuLocation.DefineAndAddMenu("!BIBENmain", (localize(menuMain))); bkbibenMenu.DefineAndAddCommand(1,"BibenDocu", (localize(menuDocu)), "");
The effect is the same as before!
I'm invoking the script without using the ESTK (because this does not work for my custom-installation of FM). I write the script in EditPadPro, save it and invoke it via File > Scripts > Run (or the catalogue). So far I'm successful - atbeit somewhat slow - with my development.
This separtation process may require that I do the second part of the menu definition this way:
menuLocation = app.GetNamedMenu("BookFormatMenu"); var bkbibenMenu = menuLocation.DefineAndAddMenu("!bkBIBENmain", (localize(menuMain))); bkbibenMenu.DefineAndAddCommand(1,"BibenDocu", (localize(menuDocu)), "");
In this case the menu entry Format > Bibliography... is present in both the document and the book, but in the book it is gray (inactive). So there is still a missing link.
Ah, now I got it: also the submenu items must be different:
var menuLocation = app.GetNamedMenu("FormatMenu"); var bibenMenu = menuLocation.DefineAndAddMenu("!BIBENmain", (localize(menuMain))); bibenMenu.DefineAndAddCommand(1,"BibenDocu", (localize(menuDocu)), ""); menuLocation = app.GetNamedMenu("BookFormatMenu"); var bkbibenMenu = menuLocation.DefineAndAddMenu("!bkBIBENmain", (localize(menuMain))); bkbibenMenu.DefineAndAddCommand(1,"bkBibenDocu", (localize(menuDocu)), "");