1 Reply Latest reply on Oct 27, 2014 10:59 AM by subieguy2

    compare a path item color

    subieguy2 Level 1

      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[i].layer == "[Layer 032 Red]"){
        if(allLines[i].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!

        • 1. Re: compare a path item color
          subieguy2 Level 1

          Figured it out!

           

          else if (allLines[i].layer == "[Layer 032 Red") {
                  if (allLines[i].strokeColor.spot != "[Spot 032 Red]") {
                      alert("Error on layer 032 Red");
                  } else {
                      alert("032 layer is good");
                  }
              }