Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.