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

Framemaker 2017 ESTK Add Custom Menu

New Here ,
May 17, 2017 May 17, 2017

Copy link to clipboard

Copied

Hello,

Can anyone share the new function names for adding a new menu ... and if possible, the name of the View menu.

Thanks,

Tracey

TOPICS
Scripting

Views

468

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 18, 2017 May 18, 2017

Copy link to clipboard

Copied

Hi Tracey,

I have a sample here that shows how to add a menu:

FrameMaker ExtendScript Samples - West Street Consulting

Look for script 05.01. For the name of the view menu, I think it is ViewMenu. Below is a function that I use when I need to find a menu or command name. It allows you to enter an optional filter string to narrow the results. If the specified string is a case-insensitive substring of the command label, it is reported, otherwise it is skipped. Since the label of the View menu is "View", I just entered "view". and ran the script to find ViewMenu.

Hope this helps.

Russ

function reportMenusAndCommands()

{

    var filter = prompt ("Filter for the menu/command search?", "(none)", "Menu/command search");

    if(filter == null) return;

    if(filter == "(none)") filter = "";

    var cmd = app.FirstMenuItemInSession;

   

    while (ov(cmd))

    {

        var cmdLabel =  cmd.Label.replace("&", "").toLowerCase();

        if(filter == "" || cmdLabel.toLowerCase().indexOf(filter) > -1)

        {

            if(!confirm("Command label:      " + cmd.Label

                + "\nCommand name:     " + cmd.Name

                + "\n\nClick No to abort the search.")) return;

           

        }

   

        cmd = cmd.NextMenuItemInSession;

    }

}

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
Community Expert ,
May 18, 2017 May 18, 2017

Copy link to clipboard

Copied

LATEST

var viewMenu, cmd;

viewMenu = app.GetNamedMenu ("ViewMenu");

cmd = viewMenu.DefineAndAddCommand (10, "ViewNavigatorPaletteCmd", "View Navigator Palette", "");

This is a simple way to add a single command to the View Menu. Then you need to handle the command when it is invoked. You use the built-in Command function:

function Command (cmd) {

    switch (cmd) {

        case 10 :

            openNavigatorPalette ();

            break;

    }

}

If you only have a single command, you don't need a switch statement, but typically you are handling multiple commands.

-Rick

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