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

How to execute a menu command

Community Beginner ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

How do I execute a menu command in InDesign? I do it like this in Illustrator.

app.executeMenuCommand("showAll");

I want to execute the "Object > Hide" and "Object > Show all on Spread".

TOPICS
Scripting

Views

990
Translate

Report

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 , Aug 23, 2018 Aug 23, 2018

You can use the following code snippet to invoke the menu

var showMenuItem = app.menus.itemByName("$ID/Main").submenus.itemByName("$ID/Object").menuItems.itemByName("$ID/Show All on Spread");

if(showMenuItem.enabled)

    showMenuItem.associatedMenuAction.invoke();

var hideMenuItem = app.menus.itemByName("$ID/Main").submenus.itemByName("$ID/Object").menuItems.itemByName("$ID/Hide");

if(hideMenuItem.enabled)

   hideMenuItem.associatedMenuAction.invoke();

-Manan

Votes

Translate
Community Expert ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

LATEST

You can use the following code snippet to invoke the menu

var showMenuItem = app.menus.itemByName("$ID/Main").submenus.itemByName("$ID/Object").menuItems.itemByName("$ID/Show All on Spread");

if(showMenuItem.enabled)

    showMenuItem.associatedMenuAction.invoke();

var hideMenuItem = app.menus.itemByName("$ID/Main").submenus.itemByName("$ID/Object").menuItems.itemByName("$ID/Hide");

if(hideMenuItem.enabled)

   hideMenuItem.associatedMenuAction.invoke();

-Manan

Votes

Translate

Report

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