Skip to main content
Participating Frequently
February 18, 2021
Question

Update or Remove Commands of Menu / ExtendScript

  • February 18, 2021
  • 1 reply
  • 293 views

Hi Community,

 

I am having a problem with updating the commands for specific menu. When I remove menu and recreate another one with same name all commands are staying the same.

I tried 2 options of deleteing menu:

// option 1

RemoveMenu("!StructuredTextContextMenu", "Menu1"); 
UpdateMenus();

 

// option 2
var oMenu = app.GetNamedMenu("!StructuredTextContextMenu");
var oAltMenu = app.GetNamedMenu("Menu1");
if (oAltMenu.ObjectValid()) { 
  oMenu.Delete(oAltMenu);
  UpdateMenus();

 

I tried to remove commands as well, but this brings to problems:

 

oCommand = app.GetNamedCommand('cmd');

// option 1, does not delete command 
oCommand.Delete();

// option 2, FrameMaker crashes , though no errors in ESTK
RemoveMenu("Menu1", oCommand.Name)
UpdateMenus();

 

Does anyone know how to update the list of commands in menu?

 

Thanks.

    This topic has been closed for replies.

    1 reply

    Legend
    February 19, 2021

    Hi,

     

    I can't say for sure, but there is a good chance that it is a bug. There are lots of problems with ExtendScript and menus that have apparently never gotten any attention. Here is another discussion about it:

     

    https://community.adobe.com/t5/framemaker/moving-menu-commands/m-p/7965085

     

    Russ