3 Replies Latest reply: Aug 28, 2015 6:26 AM by Russ Ward RSS

    Command object Delete() and CommandNum property issues

    Russ Ward Community Member

      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.

        • 1. Re: Command object Delete() and CommandNum property issues
          Russ Ward Community Member

          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

          • 2. Re: Command object Delete() and CommandNum property issues
            Klaus Göbel Community Member

            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"

            • 3. Re: Command object Delete() and CommandNum property issues
              Russ Ward Community Member

              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.