Skip to main content
Legend
September 10, 2013
Question

Command object Delete() and CommandNum property issues

  • September 10, 2013
  • 1 reply
  • 1417 views

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.

This topic has been closed for replies.

1 reply

Russ WardAuthor
Legend
May 27, 2014

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

Klaus Göbel
Legend
August 27, 2015

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"

Russ WardAuthor
Legend
August 28, 2015

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.