declare menus
var menuItem1= "xxx", ...
subs = app.menus.item("$ID/Main").submenus, sma, mnu;
Find ref menu to place your menu adjusted to it, (after window)
var refItem = app.menus.item("$ID/Main").submenus.item("$ID/&Window");
add handlers
subMenu1 = app.scriptMenuActions.add(menuItem1);
subMenu1.eventListeners.add("onInvoke", 1MenuHandler);
Add menu
mnu = subs.item(mainMenu);
if( !mnu.isValid ) mnu = subs.add(mainMenu, LocationOptions.after, refItem);
mnu.menuItems.add(subMenuUpdateContent);
Remove at later part (if not required)
if (mnu.isValid)
{
mnu.remove();
}
var menuItem1= "xxx", ...
subs = app.menus.item("$ID/Main").submenus, sma, mnu;
Find ref menu to place your menu adjusted to it, (after window)
var refItem = app.menus.item("$ID/Main").submenus.item("$ID/&Window");
add handlers
subMenu1 = app.scriptMenuActions.add(menuItem1);
subMenu1.eventListeners.add("onInvoke", 1MenuHandler);
Add menu
mnu = subs.item(mainMenu);
if( !mnu.isValid ) mnu = subs.add(mainMenu, LocationOptions.after, refItem);
mnu.menuItems.add(subMenuUpdateContent);
Remove at later part (if not required)
if (mnu.isValid)
{
mnu.remove();
}