Copy link to clipboard
Copied
You see, I'm trying to create a script to select all swatch in document and does not work.
var doc = app.activeDocument;
for (var j = 0; j < app.activeDocument.swatches.length; j++) {
thisswatch= app.activeDocument.swatches
; thisswatch.selected=true;
}
You know if it is possible?
Simply that. Thank you very much in advance.
A greeting.
Copy link to clipboard
Copied
levi2, hi!
The object Swatch has no property "selected".
What do you then want to do with the object?
New
You can get the object Swatch and then something to do with it: to use its properties, remove and place in a group. But Illustrator Swatches palette is not available from the script.
Copy link to clipboard
Copied
There is a super convoluted way to sort-of do this, which is to play an action which makes a new swatch group out of a selection (may need to draw some squares and fill them with color to produce the selection 1st.).
Now, the swatches are selected in the swatches panel, and you can use the getSelected function of the 'swatches' object to do things with - but given its limited abilities, it's not going to be as great as just being able to make a swatch 'selected' in the panel as we would expect.