Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

MenuActions not enabling in InDesign CS5.5

Advocate ,
Sep 26, 2011 Sep 26, 2011

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

TOPICS
Scripting
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 27, 2011 Sep 27, 2011

Hi, csm_phil!

Try:

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

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

Uwe

Translate
Advocate ,
Sep 27, 2011 Sep 27, 2011

Hi All,

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

thx

csm_phil

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 27, 2011 Sep 27, 2011

Hi, csm_phil!

Try:

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

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

Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 27, 2011 Sep 27, 2011

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.area+"/"+myMenuActions.id);

}

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

Larry

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 28, 2011 Sep 28, 2011

Hi,  Laubendar & Larry,

Thanks for your support. Its working fine.

thx

csm_phil

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 29, 2011 Sep 29, 2011
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines