Update or Remove Commands of Menu / ExtendScript

Community Beginner ,
Feb 18, 2021 Feb 18, 2021

Copy link to clipboard

Copied

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.

Views

62

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Feb 19, 2021 Feb 19, 2021

Copy link to clipboard

Copied

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines