Highlighted

Framemaker 2017 ESTK Add Custom Menu

New Here ,
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

343

Likes

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

Framemaker 2017 ESTK Add Custom Menu

New Here ,
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

344

Likes

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
May 17, 2017 0
Mentor ,
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;

    }

}

Likes

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
Reply
Loading...
May 18, 2017 0
Adobe Community Professional ,
May 18, 2017

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
May 18, 2017 0