7 Replies Latest reply on Apr 8, 2015 3:22 PM by howardmaler

    Top Level Menu


      Can you add a menu to the top level menu instead of a submenu for one of the existing ones, my client wants to have a menu item at the same level as File or Edit. In one of my past lives I was able to do this with a C++ plug-in. My client wishes to use a JavaScript plug-in.








        • 1. Re: Top Level Menu
          try67 MVP & Adobe Community Professional

          It can't be done with a JavaScript script, only with a plugin.


          On Wed, Apr 8, 2015 at 7:37 PM, howardmaler <forums_noreply@adobe.com>

          • 2. Re: Top Level Menu
            howardmaler Level 1

            Yes I am aware of that. That is why in my post I specified a JavaScript plug-in.


            The Client Wishes to Keep the Plug-In they have an only add a Top Level Menu. There are numerous situations where I have seen this behavior.


            I believe that if there were some way to get the parent of the top level menus it would be possible.


            I checked and it can be done in C++. The JavaScript API is limited, but they already have the ability to add sub menus and menu items to top level menus like Edit and View.


            Does that clear up what I am asking?

            • 3. Re: Top Level Menu
              try67 MVP & Adobe Community Professional

              There's no such thing as a JavaScript plugin.


              On Wed, Apr 8, 2015 at 9:54 PM, howardmaler <forums_noreply@adobe.com>

              • 4. Re: Top Level Menu
                howardmaler Level 1

                While I thank you for responding your remark is not accurate.


                This is not my first rodeo, so that was the first thing I confirmed. Consult the Acrobat JavaScript API if you do not believe this to be accurate


                JavaScript in Acrobat can operate in two modes. One as a Document Level Script and One as a Plug-In that loads when Acrobat is Loaded, this this is a folder level script otherwise known as a plug-in and is available for all documents throughout that session, exactly the same as a C++ Plug-In although much less powerful.


                There are limits to what can be done.


                With the Plug-In that I have which is written in JavaScript and Creates a Menu Item in the Edit Menu already, is there a way to get to the parent and create a top level menu item as you can in a C++ plug-in.

                • 5. Re: Top Level Menu
                  try67 MVP & Adobe Community Professional

                  I'm quite familiar with Acrobat JS and know what I'm talking about... A folder-level script is not a plugin. It's a script that's loaded with the application. You can call it a plugin if you want, but it's not. And it doesn't have the capacity to add a top-level menu, no matter what name you give it.


                  If you want proof that folder-level scripts are not plugins run this code from the JS console:


                  It will list all of the plugins in the application. You'll notice that no folder-level scripts are present in this list.

                  • 6. Re: Top Level Menu
                    gkaiseril MVP & Adobe Community Professional

                    You will need to use the Acrobat SDK to write the plug-in in a compiled computer language not a scripting language and install the complied code in a very specific directory.




                    A plugin can access the Acrobat/Reader JSO within a PDF.


                    There is a separate forum here for the Acrobat SDK..


                    Adding menu commands to menus


                    Adding menu commands to menus

                    You can use the Acrobat core API to add a new menu command to an existing menu. For example, you can add a menu command named Acrobat SDK to the Advanced menu item located in the Adobe Reader or Acrobat menu bar.


                    Retrieve the Adobe Reader or Acrobat menu bar that is represented by an AVmenubar object by invoking the AVAppGetMenubar method.
                     AVMenubar Themenubar = AVAppGetMenubar(); 
                    Retrieve the menu that will contain the new menu command by invoking the AVMenubarAcquireMenuByName method and passing the following arguments:
                    An AVmenubar object that represents the menu bar.
                    This method returns an AVMenu object that corresponds to the specified menu name.
                     AVMenu FileMenu = AVmenubarAcquireMenuByName (Themenubar, "File");
                    These objects are Acrobat JavaScript objects but part of the Acrobat Core API
                    • 7. Re: Top Level Menu
                      howardmaler Level 1



                      I  have written dozens if not hundreds of plug-ins and not just for Acrobat and I have written apps which make use of plug-ins by exposing hooks.. I know where they are published on several platforms.


                      And no matter what the semantical qualifiers they resolve down to pretty much the same behavior (not the same capabilities)


                      Basically a plug-in is a script, library or binary that can be loaded loads when the applications loads and is controlled through the application usually through a series of call backs often referred to as hooks and remains active for the life of the session.


                      I am quite aware of what a plug in is and know that you can do this in C++. It seems quite an omission for the JS API.


                      I have spent enough time on this, The Top level object is a Menu Bar not a menu.


                      Thanks for the responses. If anyone wants to follow up howard@howardmaler.com


                      Again thanks for the responses.


                      Signing off