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

How to execute a menu command

Community Beginner ,
Aug 23, 2018 Aug 23, 2018

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
1.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 , 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

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

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