1 Reply Latest reply on Jun 15, 2013 2:34 AM by DriveFST

    remove subMenuItems from created menu

    DriveFST

      Hi Forum!.

       

      I have added menuItem("AUTOMATION") in menu and subMenuItem("selectImageParent"); (to run the script "selectImageParent" by selecting from menu:

       

      var myScript1 = new File(app.filePath + "~D:\Adobe\InDesign\Version 5.0\Scripts\Scripts Panel\selectImageParent");

      var myScriptAction1 = app.scriptMenuActions.add("selectImageParent");

      var myEventListener1 = myScriptAction1.eventListeners.add("onInvoke", myScript1, false);

       

         try{

          var myScriptMenu = app.menus.item("$ID/Main").submenus.item("AUTOMATION");

          myScriptMenu.title;

      }

      catch (myError){

          var myScriptMenu = app.menus.item("$ID/Main").submenus.add("AUTOMATION");

      }

         var myScriptMenuItem1 = myScriptMenu.menuItems.add(myScriptAction1);

       

      Thing is i, cant able to remove the add subMenuItem(selectImageParent) just keeping the menuItem("Automation") unremoved.

       

      HERE IT REMOVE THE ENTIRE MENU AND THE SCRIPT

      var myScriptMenu = app.menus.item("$ID/Main").submenus.item("AUTOMATION").remove();

       

      INSTEAD I WANT TO REMOVE ONLY THE subMenu "selectImageParent" under Automation.

       

       

      Any help on this please.

        • 1. Re: remove subMenuItems from created menu
          DriveFST Level 1

          Here in this way, that can i got it....

           

          app.menus.item("$ID/Main").submenus.item("Scripts").remove();

           

          Now when i adding one more submenu like this...

           

          var myScriptMenu = app.menus.item("$ID/Main").submenus.item("Scripts").submenus.add("Sub_script");

           

          Forum, after adding, when i try to select and run the script.... nothing found to be done.... i have saved the script here...

           

          var myScript1 = new File(app.filePath + "~D:\Adobe\InDesign\Version 5.0\Scripts\Scripts Panel\selectImageParent.jsx");

           

          var myEventListener1 = myScriptAction1.eventListeners.add("onInvoke", myScript1, false);

          var myScriptAction1 = app.scriptMenuActions.add("selectImageParent.jsx");

           

          Please help me to access the script through the submenus created....