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

Add Selected Colors??

Explorer ,
Aug 01, 2016 Aug 01, 2016

Hello such. I wanted to ask if you can add in the document palette colors of selected objects using javascript.

There is an option in the menu of the color palette

Add Selected Colors

I tried this:

app.executeMenuCommand("add selected colors");

app.executeMenuCommand("Add Selected Colors");

but it does not work

I would like to add the selected color to the document but not how to do it in javascript.

Any help please?

It would also be great to clean the palette leaving only the colors used in the document using javascript.

Thank you very much for your help.

a greeting

TOPICS
Scripting
550
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
Adobe
Valorous Hero ,
Aug 01, 2016 Aug 01, 2016

It looks like there is no such menu command (I look for them here: [JS] CS6+ executeMenuCommand ), but you can record an action to do all of those actions, and have a script play them.

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
Explorer ,
Aug 01, 2016 Aug 01, 2016

First of all thanks for your answer, but I would like to get it without saving actions. Only with javascript.

Someone could give me a help please?

Thank you very much.

a greeting

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 ,
Aug 02, 2016 Aug 02, 2016
LATEST

You can make javascript write the actions, play them, and remove them without having to have any actions previously loaded, too.

Otherwise, adding colors from selection is possible by using a loop to reach each paths' fills and strokes - but if you have appearances which are stacked on top of the default shape fills and strokes which are of different colors, they have to be expanded , then raster effects will add more complexity, etc.

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