5 Replies Latest reply on Sep 29, 2011 8:51 AM by secondgradersrule

    MenuActions not enabling in InDesign CS5.5

    csm_phil Level 4

      Hi Scripters,

       

      InDesign CS4/CS5 is able to invoke menuActions using the below mentioned javascript code.

       

      var myMenuAction = app.menuActions.item("$ID/Go to Item");
      try {
          myMenuAction.invoke();
          }catch (err){exit();}; 
      

       

      However when I use the same code in InDesign CS5.5 version, we are encountering  "Action not enabled" error.

       

      Note: Please select the required XML element from the Structure Panel before running this code.

       

      Thanks & Regards

      csm_phil

        • 1. Re: MenuActions not enabling in InDesign CS5.5
          csm_phil Level 4

          Hi All,

           

          Any update on the below request, Any one please look into this.

           

          thx

          csm_phil

          • 2. Re: MenuActions not enabling in InDesign CS5.5
            Laubender Adobe Community Professional & MVP

            Hi, csm_phil!

             

            Try:

             

            app.scriptMenuActions.itemByID(78629).invoke();
            

             

            It's working in my InDesign CS 5.5 v7.5.1 (german edition).

             

            Uwe

            • 3. Re: MenuActions not enabling in InDesign CS5.5
              Larry Tseng Level 1

              Hello csm_phil,

              However when I use the same code in InDesign CS5.5 version, we are encountering  "Action not enabled" error.

               

              The Articles panel was added in CS5.5, so the name Go to Item is no longer unique. See here:

               

              myMenuActions = app.menuActions.itemByName("Go to Item").getElements();
              for (var i=0; i<myMenuActions.length; i++) {
                        alert(myMenuActions[i].area+"/"+myMenuActions[i].id);
              }
              

               

              Means you either need to invoke the action by id or do it through associatedMenuAction.

               

              Larry

              1 person found this helpful
              • 4. Re: MenuActions not enabling in InDesign CS5.5
                csm_phil Level 4

                Hi,  Laubendar & Larry,

                 

                Thanks for your support. Its working fine.

                 

                thx

                csm_phil

                • 5. Re: MenuActions not enabling in InDesign CS5.5
                  secondgradersrule Level 1

                  A related issue, perhaps.  I am trying to toggle Menu options via script, to set a user environment.  To make sure that Window->Tools is checked, this always works:

                   

                  try {

                       var myTools = app.menuActions.item("Tools").checked;

                       }

                       catch (e) {}

                   

                  if (myTools ==false) {

                      try {

                       app.menuActions.item("Tools").invoke();

                       }

                       catch (e) {}

                   

                  But I also want to toggle things that lack a checkmark, such as Hide Hidden Characters.

                   

                  This returns different results depending on whether a document is open, and sometimes does not toggle the selection (Show/Hide) and returns different values for the .checked call.

                   

                  try {

                       var myHidden = app.menuActions.item("Hide Hidden Characters").checked;

                       }

                       catch (e) {alert("Error"); }

                    if (myHidden ==false ) {

                       try {

                        app.menuActions.item("Hide Hidden Characters").invoke();

                        }

                       catch(e) {}

                    } 

                   

                  Sometimes this returns false, sometimes undefined.  I have done many iterations, also looking for ("Show Hidden Characters").checked

                  The original code was written for InCopy.  Any menu item that is truly checked is easily controlled.  The ones that toggle Show/Hide are a mess in both InCopy and InDesign. 

                   

                  Am I using the wrong syntax?

                   

                  Dick Conrad