2 Replies Latest reply on May 18, 2017 5:49 AM by frameexpert

    Framemaker 2017 ESTK Add Custom Menu




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





        • 1. Re: Framemaker 2017 ESTK Add Custom Menu
          Russ Ward Level 4

          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.



          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;
          • 2. Re: Framemaker 2017 ESTK Add Custom Menu
            frameexpert Level 4
            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 ();


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