Copy link to clipboard
Copied
Basically I am looking to find any text frame that the font is under 4PT.
Hi.. Try this.. For now i just used Black color.. if you need use any other special color you have
...var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements();
var myarray=[]
for (a=0; a<mycharacter.length; a++)
{
if (mycharacter.pointSize < 4)
{
myarray.push(mycharacter.length)
//~ mycharacter.parentTextFrames[0].fillColor="Black"; //Turn this if you need to fill the texrframes with color
mycharacter.fillColor="Black";
Copy link to clipboard
Copied
Hi.. Try this.. For now i just used Black color.. if you need use any other special color you have
var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements();
var myarray=[]
for (a=0; a<mycharacter.length; a++)
{
if (mycharacter.pointSize < 4)
{
myarray.push(mycharacter.length)
//~ mycharacter.parentTextFrames[0].fillColor="Black"; //Turn this if you need to fill the texrframes with color
mycharacter.fillColor="Black";
}
}
alert("Total characters below 4 point is:\n"+myarray.length+"\n\n"+"And now it changed to Black color")
HTH
K
Copy link to clipboard
Copied
Yes this works. Thank you.. I've tried to modify this to get rid of the Fill after the font is fixed and its not working. Can you See what i've done wrong?
var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements();
var myarray=[]
for (a=0; a<mycharacter.length; a++)
{
if (mycharacter.pointSize < 4)
{
myarray.push(mycharacter.length)
mycharacter.parentTextFrames[0].fillColor="Cyan";
mycharacter.fillColor="Cyan";
}else{
if(mycharacter.constructor.name == "TextFrame"){
if(mycharacter.fillColor.name == "Cyan"){
mycharacter.fillColor = "None";
}
}
}
}
}
Copy link to clipboard
Copied
You forgot to include loop increment..
var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements();
var myarray=[]
for (a=0; a<mycharacter.length; a++)
{
if (mycharacter.pointSize < 4)
{
myarray.push(mycharacter.length)
mycharacter.parentTextFrames[0].fillColor="Cyan";
mycharacter.fillColor="Cyan";
}else{
if(mycharacter.constructor.name == "TextFrame"){
if(mycharacter.fillColor.name == "Cyan"){
mycharacter.fillColor = "None";
}
}
}
}
this also works..
mypointsize();
function mypointsize(){
var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements();
var myarray=[]
for (a=0; a<mycharacter.length; a++)
{
if (mycharacter.pointSize < 4) {
//alert("s")
myarray.push(mycharacter.length)
mycharacter.parentTextFrames[0].fillColor="Cyan";
mycharacter.fillColor="Cyan";
}
else{return; }
}
}
HTH
K
Copy link to clipboard
Copied
When i Try these they only half work. It does Make the Text frame cyan. BUt when i correct the font size to 4PT or higher and rerun the script the Text frame still stays Cyan instead of "None".
Copy link to clipboard
Copied
HI..
If you correct the font size to 4 and still got error means use like..
if (mycharacter.pointSize <= 4)
Copy link to clipboard
Copied
Thank you for all your help. I used the below. If the FOnt is 3.9999 or lower it turns Cyan. And if the font is 4 or higher it makes it a None fill.
var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements();
var myarray=[]
for (a=0; a<mycharacter.length; a++)
{
if (mycharacter.pointSize <= 3.9999)
{
myarray.push(mycharacter.length)
mycharacter.parentTextFrames[0].fillColor="Cyan";
// mycharacter.fillColor="Cyan";
}else{
if(mycharacter.constructor.name == "TextFrame"){
if(mycharacter.fillColor.name == "Cyan"){
// mycharacter.fillColor = "None";
}
}
}
}
for (a=0; a<mycharacter.length; a++)
{
if (mycharacter.pointSize >= 4)
{
myarray.push(mycharacter.length)
mycharacter.parentTextFrames[0].fillColor="None";
// mycharacter.fillColor="None";
}else{
if(mycharacter.constructor.name == "TextFrame"){
if(mycharacter.fillColor.name == "None"){
// mycharacter.fillColor = "None";
}
}
}
}