Skip navigation
Currently Being Moderated

Find colored text

May 8, 2012 5:10 AM

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

 
Replies
  • Currently Being Moderated
    May 9, 2012 5:34 AM   in reply to SangeethaRajeshkumar

    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;
    }
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points