2 Replies Latest reply: May 9, 2012 9:43 PM by SangeethaRajeshkumar RSS

    Find colored text

    SangeethaRajeshkumar

      Hi Experts,

       

      How to grep CMYK color. i.e Find colored text by giving CMYK values like (C=0,M=100,Y=0,K=0)

       

      Regards,

      Sangeetha

        • 1. Re: Find colored text
          Kasyan Servetsky Community Member

          Here is an example:

          var doc = app.activeDocument;
          app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
          app.findGrepPreferences.fillColor = SetColor("C=0 M=100 Y=0 K=0");
          app.changeGrepPreferences.fillColor = SetColor("C=0 M=0 Y=100 K=0");
          var changeResult = doc.changeGrep();
          
          function SetColor(colorName) {
              var color;
              var swatch = doc.swatches.item(colorName);
          
              if (app.colors.item(colorName) != null) {
                  color = app.colors.item(colorName);
              }
              else {
                  color = app.colors.add({name:swatch.name, space:swatch.space, model:swatch.model, colorValue:swatch.colorValue});
              }
          
              return color;
          }
          
          • 2. Re: Find colored text
            SangeethaRajeshkumar Community Member

            Thanks Kasyan, Its very helpful for me.