Command object Delete() and CommandNum property issues
Copy link to clipboard
Copied
Hi,
FM11. I can't seem to get the Delete() method to work on commands, nor can I retreive the proper CommandNum property. For example:
cmd = DefineCommand(1111, "TestScriptCommand", "TestScriptCommand", "^q");
alert(cmd.CommandNum);
...the message box displays some other number, like 48 or something. Then, cmd.Delete() seems to have to effect, because the command stays active and remains on any menus where I placed it.
the Command() callback works OK. It properly executes on 1111 for the command.
Copy link to clipboard
Copied
Well, the following issue resolution is found in the v12.0.2 release notes, so maybe it was just a bug and is now fixed.
Unable to delete menus and commands through Delete() function.
(Ref# 3710541)
See FrameMaker Help | Adobe FrameMaker 12.0.2 ReadMe
Russ
Copy link to clipboard
Copied
Hi Russ,
after some hours of trying and testing, I found (a part of) the solution:
This works for me.
The structure of this menu:
Main Menue: mMenu
-------mMenueToDelete is Submenue of mMenu
------------mSubMenueToDelete is Submenue of mMenueToDelete
var mMenu = app.GetNamedMenu("!MakerMainMenu") ;
var mMenueToDelete = app.GetNamedMenu ("Menu2");
var mSubMenueToDelete = app.GetNamedMenu ("Menu3");
if (mMenueToDelete.ObjectValid ())
{
alert ("- Delete the old submenu: " + mSubMenueToDelete.Name);
mMenueALT.Delete (mSubMenueToDelete);
alert ("- Delete the old menu: " + mMenueToDelete.Name);
mMenu.Delete (mMenueToDelete);
UpdateMenus ( );
}
EDIT:
The problem, that still exists is:
although I've deleted the menu items, they still can be found with "app.GetNamedMenu"
Copy link to clipboard
Copied
Thanks Klaus. I was actually trying to delete commands, not menus, but I'm wondering if maybe I just forgot to call UpdateMenus(). I appreciate the information.

