• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Command object Delete() and CommandNum property issues

Mentor ,
Sep 10, 2013 Sep 10, 2013

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.

TOPICS
Scripting

Views

1.3K

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 ,
May 27, 2014 May 27, 2014

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

Votes

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
Enthusiast ,
Aug 27, 2015 Aug 27, 2015

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"

Votes

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 ,
Aug 28, 2015 Aug 28, 2015

Copy link to clipboard

Copied

LATEST

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.

Votes

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