Invoke a menu item by ID
Not every menu item is available via the InDesign scripting API,
Fortunately, we can always invoke a menu item by name, or even better, ID.
Find the item ID by running this Snippet from Jongware:
1 2 3 4 5 |
res = []; for(a=0; a<app.menuActions.length; a++){ res.push(app.menuActions[a].name+"("+app.menuActions[a].area+") = "+app.menuActions[a].id); } app.selection[0].contents = res.join(" , "); |
Then use the id
to invoke the menu:
1 2 3 |
try{ app.menuActions.itemByID(id).invoke(); }catch (e){ alert(e)}; |