Here is an example:
#targetengine “dentistw”
var myScript1 = new File(app.filePath + “/Scripts/Scripts Panel/uniquePDFexport.scpt”);
var myScriptAction1 = app.scriptMenuActions.add(“PDF export”);
var myEventListener1 = myScriptAction1.eventListeners.add(“onInvoke”, myScript1, false);
try{
var myScriptMenu = app.menus.item(“$ID/Main”).submenus.item(“Scripts”);
myScriptMenu.title;
}
catch (myError){
var myScriptMenu = app.menus.item(“$ID/Main”).submenus.add(“Scripts”);
}
var myScriptMenuItem1 = myScriptMenu.menuItems.add(myScriptAction1);
Save it to the “Scripts > Startup Scripts” folder and restart InDesign. A new “Scripts” menu will appear with a single “PDF export” item which will trigger the uniquePDFexport.scpt script (change the name to whatever your script's name is, of course).
You can easily add more menu items by coping and pasting lines 2-4 and the last one and incrementing the number at the end of the variabels' names and making necessary changes to these lines.
For example:
var myScript2 = new File(app.filePath + “/Scripts/Scripts Panel/YourAnotherScriptName.scpt”);
var myScriptAction2 = app.scriptMenuActions.add(“Do Something Else”);
var myEventListener2 = myScriptAction2.eventListeners.add(“onInvoke”, myScript2, false);
…..
var myScriptMenuItem2 = myScriptMenu.menuItems.add(myScriptAction2);
You can also insert separators like so:
var myScriptMenuItem8 = myScriptMenu.menuItems.add(myScriptAction8);
var myMenuSeparator3 = myScriptMenu.menuSeparators.add(LocationOptions.AFTER, myScriptMenuItem8);
Hope this helps.
Kas