Copy link to clipboard
Copied
Hi Everyone!,
This is Yajiv and I am purely new baby to this illustrator scripts. I need guidance to solve my problem.
I have an Illustrator documents contains text with Chinese font. Text color 100% process black and I need to fix OverPrint.
85% of texts convert into over print but some of character did not convert into OverPrint. Kindly guide to solve this problem.
Thanks,
- yajiv
Sample Text : 电脑贸易 (88-88)
Code:
CheckOverPrintoftheObject(0,0,0,100,false,true);
function CheckOverPrintoftheObject(c,m,y,k,flg1,flg2){
// To check Text as Over Print........
count = docRef.textFrames.length;
//alert(count);
for ( i = 0; i < count; i++ ) {
textArt = activeDocument.textFrames;
//alert(textArt.words.length);
for ( j = 0; j < textArt.words.length; j++) {
word = textArt.words
var SWColor = word.fillColor;
var SWSTColor = word.strokeColor;
if (SWColor.typename=="CMYKColor"){
//alert("in CMYK Fill ");
var c1=Math.round(SWColor.cyan);
var m1=Math.round(SWColor.magenta);
var y1=Math.round(SWColor.yellow);
var k1=Math.round(SWColor.black);
if (( c1 == c ) && ( m1 == m) && ( y1 == y ) && ( k1 == k ) && (word.characterAttributes.overprintFill==flg1)) {
word.characterAttributes.overprintFill=flg2;
}
}
}
}
}
you have a few "var" declarations missing. just for good practice
I think to be reliable you need to cycle Chars not words.
I ran this on some sample text and circled the text that has been set to overprint.
you can see that it seems to look at the first Char in the word and assumes the whole word is the same formatting.
Copy link to clipboard
Copied
you have a few "var" declarations missing. just for good practice
I think to be reliable you need to cycle Chars not words.
I ran this on some sample text and circled the text that has been set to overprint.
you can see that it seems to look at the first Char in the word and assumes the whole word is the same formatting.
Copy link to clipboard
Copied
This works perfect! Thank you so much, Qwertyfly!
- yajiv
Code:
CheckOverPrintoftheObject(0,0,0,100,false,true);
function CheckOverPrintoftheObject(c,m,y,k,flg1,flg2){
var docRef = app.activeDocument;
// To check Text as Over Print........
var count = docRef.textFrames.length;
for ( i = 0; i < count; i++ ) {
var textArt = activeDocument.textFrames;
for ( j = 0; j < textArt.characters.length; j++) {
var word = textArt.characters
var SWColor = word.fillColor;
var SWSTColor = word.strokeColor;
if (SWColor.typename=="CMYKColor"){
//alert("in CMYK Fill ");
var c1=Math.round(SWColor.cyan);
var m1=Math.round(SWColor.magenta);
var y1=Math.round(SWColor.yellow);
var k1=Math.round(SWColor.black);
//alert("( "+c1+" == "+c+" ) && ( "+m1+ "== "+m+") && ( "+y1+ "== "+y+" ) && ( "+k1+" == "+k+" ) && ("+word.characterAttributes.fillOverprint+"=="+flg1+")");
if (( c1 == c ) && ( m1 == m) && ( y1 == y ) && ( k1 == k ) && (word.characterAttributes.overprintFill==flg1)) {
word.characterAttributes.overprintFill=flg2;
}
}
}
}
}
Copy link to clipboard
Copied
Glad I could help