Applescript/javascript to run a panel menu command in Illustrator

Explorer ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

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!

TOPICS
Scripting

Views

58

Likes

Translate

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

Advocate , Jul 06, 2022 Jul 06, 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

Likes

Translate

Translate
Advocate ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

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