3 Replies Latest reply on Dec 18, 2014 8:29 PM by Adobe-InDesign CS4

    adding script into menu bar

    VeluVK Level 1

      Hi,

       

      I have some scripts in each projects. I need to run one by one base on the project. Can i have any option to add this scripts into menu bar?

       

       

      Please suggest.

       

       

      Regards,

      velu

        • 1. Re: adding script into menu bar
          Adobe-InDesign CS4 Level 1

          Dear Velu

           

          //============================ Script Start ===================================//

          var tableMenu = app.menus.item("$ID/Main").submenus.item("Table"); 

           

           

           

          try { 
          var subMenu = tableMenu.submenus.item("Floating Tables"); 
              subMenu.title; 
          catch(err) { 
          var subMenu = tableMenu.submenus.add("Floating Tables", LocationOptions.AT_END); 
          var topLeftAction = app.scriptMenuActions.add("Top Left"); 
          var topLeftListener = topLeftAction.eventListeners.add("onInvoke", FloatingTablesHandler); 
          var topLeftMenuItem = subMenu.menuItems.add(topLeftAction);

           

          //============================ Script End ===================================//

          Please Use the above code that will helps with you

           

          Thanks & Regards

          T.R.Harihara Sudhan

          • 2. Re: adding script into menu bar
            VeluVK Level 1

            Hi Hari,

             

            I will try this. Thank u for the script.

             

             

            Regards,

            Velu

            • 3. Re: adding script into menu bar
              Adobe-InDesign CS4 Level 1

              Dear Velu

               

              Please try one more method of the Menu Action:

               

              //=============================Script Start =============================//

               

              var mySampleScriptAction = app.scriptMenuActions.add("First Script");

              var myEventListener = mySampleScriptAction.eventListeners.add("onInvoke", function(){alert("This menu item was added by a script.");});

              //If the submenu "Script Menu Action" does not already exist, create it.

              try{

                  var mySampleScriptMenu = app.menus.item("$ID/Main").submenus.item("NewMenu");

                  mySampleScriptMenu.title;

              }

              catch (myError){

                  var mySampleScriptMenu = app.menus.item("$ID/Main").submenus.add("New Menu");

              }

              var mySampleScriptMenuItem = mySampleScriptMenu.menuItems.add(mySampleScriptAction);

               

              //============================== Script End ===============================//

               

              Thanks & Regards

              T.R.Harihara Sudhan