Skip to main content
Fobioid
Inspiring
July 6, 2022
Answered

Applescript/javascript to run a panel menu command in Illustrator

  • July 6, 2022
  • 1 reply
  • 561 views

So I know how to script a menu command from the menu bar, but is there a way to run a command from a panel menu?

 

Here is an example of a menu command:

 

tell application "System Events" to tell process "Illustrator"

click menu item "Unlock All" of menu 1 of menu bar item "Object" of menu bar 1

end tell

 

Ideally I'd like to "Add Used Colors" from the Swatches panel menu. 

 

Is there a...

 

click menu item "Add Used Colors" of "Swatches" menu

 

...or something like that?

 

Maybe this isn't a System Event, but an Illustrator command, but I don't see anything in the dictionary for it.

 

Any help would be appreciated!

This topic has been closed for replies.
Correct answer Mike Bro

Hello @Fobioid,

I don't think there's a app.executeMenuCommand to Add Used Colors from the swatches panel.

What you could do is record/create a action that "Add Used Colors" then you can execute the action with the script below. You'll need to plug in the name of your action and the name of the set it resides in.

app.doScript("Name of Action", "Name of Action Set")

 

Regards,

Mike

1 reply

Mike BroCorrect answer
Legend
July 7, 2022

Hello @Fobioid,

I don't think there's a app.executeMenuCommand to Add Used Colors from the swatches panel.

What you could do is record/create a action that "Add Used Colors" then you can execute the action with the script below. You'll need to plug in the name of your action and the name of the set it resides in.

app.doScript("Name of Action", "Name of Action Set")

 

Regards,

Mike