Copy link to clipboard
Copied
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
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.textRange;
readFillColor = textItemsRange.characterAttributes.fillColor
if(readFillColor.ty
...Copy link to clipboard
Copied
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.textRange;
readFillColor = textItemsRange.characterAttributes.fillColor
if(readFillColor.typename == "RGBColor")
{
//alert("Found RGBColor")
}
else{
//alert("Found GrayColor")
textItemsRange.remove();
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now