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

[JS] CS6+ executeMenuCommand

Community Expert ,
Feb 12, 2014 Feb 12, 2014

Hello together,

since CS6+ there is possible to

executeMenuCommand (menuCommandString: string)

Executes a menu command using the menu shortcut string.

Question 1:

Who knows a way to read all the available commands?

Question 2:

At the time I need 'Clear Guides'

app.executeMenuCommand ('Clear Guides')

app.executeMenuCommand ('Clear guides')

app.executeMenuCommand ('clear Guides')

app.executeMenuCommand ('ClearGuides')

app.executeMenuCommand ('clear guides')

and other variants doesn't work.

Who know the right syntax? (Or is this menu command not available????)

Any help is appreciated. (Additional: I know the way to use app.doScript (myAction) - but this is not part of my questions)

TOPICS
Scripting
73.6K
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 2 Correct answers

Community Expert , Feb 12, 2014 Feb 12, 2014

try

app.executeMenuCommand ('clearguide')

and let us know if it works, I don't have CS6 to try

Translate
Explorer , Mar 12, 2014 Mar 12, 2014

Hi guys,

I am posting almost complete list of menu commands.

Already removed plugin-like commands which does not work at all. Some of the entries are still to be confirmed.

There are some entries like for eg. AdobeLayerPalette:

- AdobeLayerPalette1 - show on/off layers window

- AdobeLayerPalette2 - create new layer with no dialog popup

- AdobeLayerPalette3 - create new layer with dialog popup

or

- AdobeNavigator1 - does not work

- AdobeNavigator2 - does not work as well

- AdobeNavigator - show on/off n

...
Translate
Adobe
Valorous Hero ,
Dec 08, 2015 Dec 08, 2015

Adding to this helpful post a couple of things I've found:

Selection Hat 3 is Select > Object > All on Same Layers

Planet X is Live Paint, Ten_A knew this already in his reference table.

Most of these can be obtained from checking out the .kys saved shortcut keys file and in those non-obvious cases, assigning a key to the menu item, saving the keyboard shortcuts and finding the key char code to narrow down the list of possible items.

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 ,
Dec 30, 2016 Dec 30, 2016

Adding:

app.executeMenuCommand('selectall');

app.executeMenuCommand('deselectall');

app.executeMenuCommand('selectallinartboard');

And furthermore:

CarlosCanto schrieb:

these are my findings

  1. SelectionHat1//SelectDirectionHandles
  2. SelectionHat10//saveselection...(dialog)
  3. SelectionHat11//editselection...(dialog)
  4. SelectionHat12//SelectObjectsNotAlignedtoPixelGrid
  5. SelectionHat2//ObjectArrangeSendtocurrentlayer
  6. SelectionHat3//selectallonsamelayer
  7. SelectionHat4//hideallartworkAbove
  8. SelectionHat5//lockallartworkAbove(andtouchingselectedart)thisisgreatitdoesHitTesttoknowwhat'saboveandtouching
  9. SelectionHat6//hideotherlayers
  10. SelectionHat7//lockotherlayers
  11. SelectionHat8//Select->NextObjectAbove(stackingorder)
  12. SelectionHat9//Select->NextObjectBelow(stackingorder)

A
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 ,
Dec 07, 2017 Dec 07, 2017

Here is a updated list for ver.22.

Illustrator CC(ver.22) menu commands list | CC Labo

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
Valorous Hero ,
Dec 08, 2017 Dec 08, 2017

What is the "Create Eve Dialog"?

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 ,
Dec 08, 2017 Dec 08, 2017

Thank you for your notify.

Its used in debug environment and I removed it from list.

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
Valorous Hero ,
Dec 11, 2017 Dec 11, 2017

So it did not do anything?

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 ,
Dec 11, 2017 Dec 11, 2017

Yes, It's used in native SDK. we can't use it in ExtendScript.

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 ,
Dec 08, 2017 Dec 08, 2017

thanks Ten, is there anything new and exiting?

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 ,
Dec 08, 2017 Dec 08, 2017

I included a few things that were not listed in the previous list like Photoshop plugins and some panels under the windows menu.

And removed around legacy text conversions because of their not work correctly.

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
Advisor ,
Jul 14, 2022 Jul 14, 2022
LATEST

For those in need, ive found a list of v25

https://ten-artai.com/illustrator-ccver-22-menu-commands-list/

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
Participant ,
Sep 01, 2015 Sep 01, 2015

You don't know a way to set the amount that it needs to offset do you? Rather than the UI to enter the amount?

-Boyd

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
Guide ,
Sep 01, 2015 Sep 01, 2015

the executeMenuCommand is like you have just clicked the menu item.

so you cannot bypass the UI using this method.

can be done via an action.

action can be created , Run and destroyed via javascript

this example will work. just be careful as it does not have any safeguards.

ie,  var f = new File('~/ScriptAction.aia');  will overwrite any file of that name in that location. then the script removes the file deleting it from your system.

if you had a file of that name in that location then ... bad luck...

and does not check if action of that name exists etc...

function offset_item_via_action(){

    // Set your offset distance here

    var Offset = "25.0";

    //

    if(app.documents.length = 0){return;}

    var ActionString = [

'/version 3',

'/name [ 16',

  '53637269707465645f416374696f6e73',

']',

'/isOpen 1',

'/actionCount 1',

'/action-1 {',

  '/name [ 13',

  '4f66667365745f416374696f6e',

  ']',

' /keyIndex 0',

  '/colorIndex 0',

' /isOpen 1',

  '/eventCount 1',

' /event-1 {',

  '/useRulersIn1stQuadrant 0',

' /internalName (ai_plugin_offset)',

  '/localizedName [ 11',

  '4f66667365742050617468',

  ']',

' /isOpen 1',

  '/isOn 1',

' /hasDialog 1',

  '/showDialog 0',

' /parameterCount 3',

  '/parameter-1 {',

  '/key 1868985204',

' /showInPalette -1',

  '/type (unit real)',

' /value ' + Offset + '',

  '/unit 592476268',

  '}',

' /parameter-2 {',

  '/key 1835627634',

' /showInPalette -1',

  '/type (real)',

' /value 4.0',

  '}',

' /parameter-3 {',

  '/key 1785623664',

' /showInPalette -1',

  '/type (enumerated)',

' /name [ 5',

  '4d69746572',

  ']',

  '/value 2',

  '}',

  '}',

'}'

    ].join('\n');

    createAction(ActionString);

    var ActionString = null;

    app.doScript("Offset_Action", "Scripted_Actions", false);

    app.unloadAction("Scripted_Actions","");

    function createAction (str) {

        var f = new File('~/ScriptAction.aia');

        f.open('w');

        f.write(str);

        f.close();

        app.loadAction(f);

        f.remove();

    }

}

offset_item_via_action();

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
Advisor ,
Jul 14, 2022 Jul 14, 2022

@Zenek_Demar 

 So handy having these codes! Could i ask how you get all of these? 
Im also looking for a scsriptlistener for Illustrator, if that exists

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 Beginner ,
Jan 22, 2018 Jan 22, 2018

Is it possible to pass parameters to a Effect? say, an Effect->Distort->Roughen?
I would like to randomize parameters for, e.g., each path.

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 ,
Jan 22, 2018 Jan 22, 2018

no, not possible but you can use applyEffect()

check these threads for more info

Re: PageItem.applyEffect(LiveEffectXML)

Re: Applying Live effects (offset path) in Illustrator using AS

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
Valorous Hero ,
Jan 22, 2018 Jan 22, 2018

Carlos speeds past me to the finish line!

I was gonna say: read this:

Re: PageItem.applyEffect(LiveEffectXML)

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 ,
Apr 03, 2021 Apr 03, 2021

Only as a small addition.

How to get the name for a specific menu command (if not already listed):

 

pixxxelschubser_0-1617482620096.pngexpand image

Thank you so much!!

 

I'm still baffled at how badly Adobe has documented their stuff (and the lack of tutorials they provide)!

Any idea where I could find the latest menu commands list (for Illustrator CC 2020)?

 

From your links and this post (https://community.adobe.com/t5/illustrator/get-menu-command-strings/m-p/8539169?page=1#M216220), I found a way to get the menu command:

(Explained here for future lost programmers 😉 )

1) Create a new Action set

2) Then choose "Insert Menu Item"

3) Search for the right menu item and add it to the action set.

4) Click "Save Actions" from the small menu in the Action panel

5) Open the saved .aia file in some text editor

6) Find the 'event', in my case it was under "/event-2 {"

7) In my case '/parameter-1' had a '/value' of "4c6976652041646f62652050534c20476175737369616e20426c7572"

8) Convert that value from HEX to ASCII (I used: https://www.rapidtables.com/convert/number/hex-to-ascii.html) and get the menu command. In this case "Live Adobe PSL Gaussian Blur". (Which worked when used in Illustrator CC 2020.)

 

I still get the popup dialog with the options to adjust. So if anyone knows how to set these and skip the dialog, that would be awesome !


By philipv71883047

                                                                                       --> jump to quoted post

 




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