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

Is it possible to select a swatch or more by javascript?

Explorer ,
Aug 27, 2016 Aug 27, 2016

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.

TOPICS
Scripting
533
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
Engaged ,
Aug 27, 2016 Aug 27, 2016

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.

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

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.

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