4 Replies Latest reply on Sep 5, 2016 1:00 AM by Paragraphix

    [Need help] removing Menu item

    Paragraphix Level 1



      Iam working on a little Menu for InDesign to make life easier for my colleagues.

      Somehow i did not pay attention for a second and added a new Menue item that does not seem to have a name.


      Bildschirmfoto 2016-09-05 um 08.39.34.png


      I use this code to remove old menu entrys / clear the one iam working one before reloading it:


      function main2(){


      The problem is that it does not seem to work if the Menu item does not have a name by itself.. any idea on this?

      Maybe there is a way to do it by "ID"? Or am i just too blind to see the obvious?


      Thanks in advance!

        • 1. Re: [Need help] removing Menu item
          Peter Kahrel Adobe Community Professional & MVP

          You can try deleting the sumenu by index, e.g.




          if your nameless submenu is the fourth menu. To make sure you use the correct index, display all names of the submenus of the main menu. Your nameless menu name should appear as two commas, as in




          which shows that there is a nameless submenu between Object and Table, or submenu[5].


          If that doesn't work you can always restart InDesign and remove the preferences (Ctrl+Alt+Del on Windows).



          • 2. Re: [Need help] removing Menu item
            Paragraphix Level 1

            Thanks - that helped a lot!


            first i used: alert(app.menus.item("$ID/Main").submenus[10].name)

            to get the empty "name" and see which one is empty.


            ( where i manually increased the number by 1 each time... so i could be sure to get the right number - also didn't want to write a loop for this for the same reason. Also there are not that many Items..)


            and then:



            to remove it – Thanks a lot!

            I know i could have reset my preferences but i wanted a better solution in case this happens again!

            • 3. Re: [Need help] removing Menu item
              Peter Kahrel Adobe Community Professional & MVP

              > didn't want to write a loop


              No need for that. everyItem() is your second-best friend:




              prints the names separated by a comma.



              • 4. Re: [Need help] removing Menu item
                Paragraphix Level 1

                Yeah i guess i could have done that and then count starting from 0... but i pretty much hit it first try so no big deal.


                Thanks for the information though - maybe i should make it my second-best friend


                I just started with JavaScript and InDesign turned out to be challenging sometimes..

                I also have some other problems i could not solve yet - but i wanted to see if i can do it myself before posting it here.