Copy link to clipboard
Copied
Hi,
I need to prepare a script that should check and log number of files in a folder.
This is to check the text objects in the document whether it contains any color text (non black text).
Problem with my script is that
1. it wont loop trough all the files in the folder, it just check the first file and ends.
2. if a document consist of more number of text in color it writes each times upto the length of text in color. i just want single instance of check for a single file.
#target illustrator
var inputFolder = Folder.selectDialog ("Select a folder contains '*.eps' files ")
var Loginfo = new File(inputFolder+"/ScriptLog.txt");
Loginfo.open("w", "TEXT", "????");
if (inputFolder != null){
var fileList = inputFolder.getFiles('*.eps');
for (var i = 0; i < fileList.length; i++){
if (fileList instanceof File && fileList.hidden == false){
var docRef = open( fileList )
writeLog()
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES)
}
}
}
Loginfo.close();//This function is to check the text objects in the document whether it contains any color text (non black text).
function writeLog(a){
var a = app.activeDocument
if(a.textFrames.length>0){
for (i = 0; i < a.textFrames.length; i++ ){
var text = a.textFrames.textRange;
var fiTxtColor = text.fillColor;
var txtColorType = String (fiTxtColor)
var txtColorGray = txtColorType.search ('Gray')
if(txtColorGray != 1){
Loginfo.writeln("File: "+a.name+" Text not in Black")
}
}
}
}
Hope i clearly explained my need.
Help me on this Guys..!!!!
Thanks in advance..
#target illustrator var inputFolder = Folder.selectDialog("Select a folder contains '*.eps' files "); var Loginfo = new File(inputFolder + "/ScriptLog.txt"); Loginfo.open("w", "TEXT", "????"); if (inputFolder) { var fileList = inputFolder.getFiles('*.eps'); for (var i = 0; i < fileList.length; i++) { if (fileList instanceof File && fileList.hidden == false) { var doc = app.open(fileList); doc.textFrames.length && writeLog(doc); doc
...Copy link to clipboard
Copied
#target illustrator var inputFolder = Folder.selectDialog("Select a folder contains '*.eps' files "); var Loginfo = new File(inputFolder + "/ScriptLog.txt"); Loginfo.open("w", "TEXT", "????"); if (inputFolder) { var fileList = inputFolder.getFiles('*.eps'); for (var i = 0; i < fileList.length; i++) { if (fileList instanceof File && fileList.hidden == false) { var doc = app.open(fileList); doc.textFrames.length && writeLog(doc); doc.close(SaveOptions.DONOTSAVECHANGES); } } } Loginfo.close(); //This function is to check the text objects in the document whether it contains any color text (non black text). function writeLog(a) { var i = 0, text = a.textFrames, len = text.length; for (; i < len; i++) { if (String(text.textRange.fillColor).search("Gray") != 1) { Loginfo.writeln("File: " + a.name + " Text not in Black"); return } } }
But isn't a CMYKColor [0, 0, 0, 100] also Black?
Copy link to clipboard
Copied
Thanks Moluapple,
Its fine..
But isn't a CMYKColor [0, 0, 0, 100] also Black?
Yes, no doubt in it..
but no prob to worry for it..