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

compare a path item color

Engaged ,
Oct 27, 2014 Oct 27, 2014

Is there a way to compare a pathItems swatch color? For example I have a layer named "032 Red" if the pathItem on this layer does NOT have a swatch color named "032 Red" alert the user there is a problem. If everything is ok alert the user that it is all good.

#target illustrator

var doc = app.activeDocument;

var allLayers = doc.layers;

var allLines = doc.pathItems;

var allSwatches = doc.swatches;

var redSwatch = allSwatches['032 Red'].color;


else if (allLines.layer == "[Layer 032 Red]"){

  if(allLines.strokeColor != redSwatch){

  alert("Error on layer 032 Red");

  }

  else{

  alert("032 Red layer is good");

  }

  }

That is just a snippet of my code but if anyone can help with that I would appreciate it!

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

Engaged , Oct 27, 2014 Oct 27, 2014

Figured it out!

else if (allLines.layer == "[Layer 032 Red") {

        if (allLines.strokeColor.spot != "[Spot 032 Red]") {

            alert("Error on layer 032 Red");

        } else {

            alert("032 layer is good");

        }

    }

Translate
Adobe
Engaged ,
Oct 27, 2014 Oct 27, 2014
LATEST

Figured it out!

else if (allLines.layer == "[Layer 032 Red") {

        if (allLines.strokeColor.spot != "[Spot 032 Red]") {

            alert("Error on layer 032 Red");

        } else {

            alert("032 layer is good");

        }

    }

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