Skip navigation
Currently Being Moderated

[JS]: Accessing Menu Items in CS6

Jul 16, 2012 9:08 AM

Tags: #color #script #javascript #menu #scripting #cs6 #menu_items #illustrator_cs6

Hi,

 

So I just got CS6, and I'm wondering how I access menu items using Javascript?

Also, I'm looking at the CS6 JS reference, and it doesn't say whether app.activeDocument.selection is Read-Only. Hopefully not, because I would need this for my purposes in accessing the menu.

The item I wanna access is Select > Same > Stroke Color. Seems simple enough. Any help would be appreciated!

 
Replies
  • Currently Being Moderated
    Jul 16, 2012 6:47 PM   in reply to alexthebake

    I have discovered a list myself, see https://gist.github.com/2719021, more info: http://goo.gl/EYBwa (Chinese)

     

    For what you need is : app.executeMenuCommand('Find Stroke Color menu item');

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2012 6:38 PM   in reply to alexthebake

    You are welcome.

     

    Let me explain a bit (in English) how I know that. The point is that the underlying menu item name is recorded in action when you insert menu item into it. It's not recorded as normal string but as hex value, so I convert and get it.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 19, 2012 11:37 AM   in reply to alexthebake

    You can find the Menu Shortcut Hotkeys text file and use the menu comman strings there.  The .kys file should be located in the installation directory under Presets.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 19, 2012 7:14 PM   in reply to Silly-V

    Thanks! However, that is useful but not always good luck.

     

    For example, "Drop Shadow" menu can be found twice in the .kys file, but none of these string is valid for app.executeMenuCommand(), the right string is "Live Adobe Drop Shadow".

    And another, "OffsetPath2" will not work, the right one is "OffsetPath v22". And so on...

     

    After some discoveries, I think menu strings in the .kys file that contain "\" will always work well.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points