3 Replies Latest reply on Mar 20, 2010 6:30 PM by Tom Tomasko

    [JS CS3] Why do sub menus disappear?

    Tom Tomasko Level 1

      Hello,

       

      The below script creates a new menu with three sub menus. One of the sub menus invokes a script, while the other two are still under construction. This seems to work except for one irksome thing: When I close InDesign and then reopen it, the menu ("PPcheck") exists but the sub-menus are no longer under the menu. How do I make them permanent?

       

      Thanks,

      Tom

       

      #targetengine session

       

      var englishCheck = new File( "~/Library/Preferences/Adobe InDesign/Version 5.0/Scripts/Scripts Panel/Format/formatCheckWindow.jsx");

      var englishCheckMenu = app.scriptMenuActions.add("Main-English");
      englishCheckMenu.eventListeners.add("onInvoke", englishCheck, false);

       

      var frenchCheckMenu = app.scriptMenuActions.add("Main-French");
      frenchCheckMenu.eventListeners.add("onInvoke", underConstruct, false);

       

      var spanishCheckMenu = app.scriptMenuActions.add("Main-Spanish");
      spanishCheckMenu.eventListeners.add("onInvoke", underConstruct, false);

       

      //following creates menu if it does not exist
      try{
          var scriptMenu = app.menus.item("$ID/Main").submenus.item("PPcheck");
          scriptMenu.title;
      }
      catch (e){
          var scriptMenu = app.menus.item("$ID/Main").submenus.add("PPcheck");
      }

       

      //following adds sub menu items
      scriptMenu.menuItems.add(englishCheckMenu);
      scriptMenu.menuItems.add(frenchCheckMenu);
      scriptMenu.menuItems.add(spanishCheckMenu);

       

      //****functions******
      function underConstruct(){
          alert("The French and Spanish semi-automatic checkers are still under construction.");
      }