3 Replies Latest reply on Aug 7, 2010 3:23 PM by Marijan Tompa [tomaxxi]

    Creating custom menu item

    Peter Celuch Level 4

      Hi guys,

      I'm trying to create a menu item in main InDesign menu. Is it possible with *.jsx?

       

      The idea is to have menu like this: File | Edit | Layout | MyMenuGroup | Type ...

       

      thanks!

        • 1. Re: Creating custom menu item
          Joe.Charles Level 1

          Insert this code within a startup script:

           

           

              try{


                  companyMainMenu=app.menus.item("$ID/Main").submenus.item("Company Name");
                  companyMainMenu.title;
              } catch (e){
                  companyMainMenu=app.menus.item("$ID/Main").submenus.add("Company Name");
              }
            
              var Script1=new File(SCRIPTS_PATH+"Configure.jsx");
              var ScriptAction1=app.scriptMenuActions.add("Configure");
              var EventListener1=ScriptAction1.eventListeners.add("onInvoke",Script1,false);
              var utilesScriptMenuItem1=companyMainMenu.menuItems.add(ScriptAction1);
            
              var SubMenu; // First level submenu
              try{
                  SubMenu=companyMainMenu.submenus.item("Submenu 1");
                  SubMenu.title;
              } catch (e){
                  SubMenu=companyMainMenu.submenus.add("Submenu 1");
              }
              var submenuScript1=new File(SCRIPTS_PATH+"Action.jsx");
              var submenuScriptAction1=app.scriptMenuActions.add("Action");
              var submenuEventListener1=submenuScriptAction1.eventListeners.add("onInvoke",submenuScript1,f alse);
              var submenuScriptMenuItem1=SubMenu.menuItems.add(submenuScriptAction1);
          • 2. Re: Creating custom menu item
            Peter Celuch Level 4

            Excellent! Works like a charm!

            Many thanks for quick answer.

            • 3. Re: Creating custom menu item
              Marijan Tompa [tomaxxi] Level 4

              Hey!

               

              Here you can find slightly different aproach to same thing.

              Also, menu is placed after Layout item as you asked.

               

              http://bit.ly/dARyns

               

              --

              tomaxxi

              http://indisnip.wordpress.com/

              1 person found this helpful