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

Create swatch group and add existing spot colors to group

New Here ,
Oct 11, 2018 Oct 11, 2018

All,

Thanks in advance for any help with this. I am trying to script the creation of a swatch group and then select all spot colors in the document and add them to the group. This is what I have so far.

var doc = app.activeDocument; 

var colorgroup = doc.swatchGroups.add(); 

  colorgroup.name = 'ArtiosCad';

//var selSwatch = doc.swatches.getSelected();   

//var swatch = doc.swatches;   

   

    for (a=0; a<doc.swatches.length; a++) {   

      var currentSwatch = doc.swatches;

  var swatchColor = currentSwatch.color;

      if (swatchColor == "SpotColor") {

              

           //colorgroup.colors.push(swatchColor);

            colorgroup.addSpot(swatchColor);     

            } 

     }

I am not very familiar with java script and am piecing this together from other answers found on the site. Any help would be appreciated. Thanks.

TOPICS
Scripting
495
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

correct answers 1 Correct answer

Advocate , Oct 11, 2018 Oct 11, 2018

Salut !

Move spot in group...

var doc = activeDocument;

  if (doc.spots.length >1) {

    var colorgroup = doc.swatchGroups.add();

        colorgroup.name = 'ArtiosCad';

      for (i = 0; i < doc.spots.length-1; i++) {

        colorgroup.addSpot(doc.spots);

      }

  }

Translate
Adobe
Advocate ,
Oct 11, 2018 Oct 11, 2018

Salut !

Move spot in group...

var doc = activeDocument;

  if (doc.spots.length >1) {

    var colorgroup = doc.swatchGroups.add();

        colorgroup.name = 'ArtiosCad';

      for (i = 0; i < doc.spots.length-1; i++) {

        colorgroup.addSpot(doc.spots);

      }

  }

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
New Here ,
Oct 11, 2018 Oct 11, 2018
LATEST

Thank you! I really appreciate the help with this.

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