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

    Deleting text frames without a specific fill color

    subieguy2 Level 1

      I was wondering if someone might be able to tell me a simple way in javascript to scan through all the text frame in my active document that are NOT filled with the following RGB values...

      fillColor.red = 11

      fillColor.green = 142

      fillColor.blue = 196

       

      Windows 7 64 bit, CS4

        • 1. Re: Deleting text frames without a specific fill color
          subieguy2 Level 1

          I changed my concept to make it more dynamic for my purpose. I am checking to see if the fillColor typename is RGBColor or GrayColor. I am deleting anything that is GrayColor. Thought I would share the code for the community to use as you wish. Hope it helps somebody!

           

          var doc = app.activeDocument

          var allText = doc.textFrames;

          var readFillColor = [];

           

          for(i=0; i<allText.length; i++)

          {

            textItemsRange = allText[i].textRange;

            readFillColor[i] = textItemsRange.characterAttributes.fillColor

            if(readFillColor[i].typename == "RGBColor")

            {

            //alert("Found RGBColor")

            }

          else{

            //alert("Found GrayColor")

            textItemsRange.remove();

            }

          }