I have a test script I wrote to open illustrator files, add some text and then save them.
What I want to do is get a list of filenames, text info, and filename to save to, from a CSV. My example code works I just don't know how to import the CSV into the const filenames, const templatefiles, const personalisation etc
Thanks for any insight you guys can give 🙂
#target Illustrator
const filenames = ["f1", "f2","f3"]
const templatefiles = ["TEMPLATE_CUS_PAD40_03.ai", "TEMPLATE_CUS_PAD40_03.ai","TEMPLATE_CUS_PAD40_03.ai"];
const personalistation = ["personalisation text 1", "personalisation BLAH 2","personalisation MEH 3"];
const filepath = 'E:/Products/ALL FILES/';
function ProcessFiles()
{
for(processedfiles = 0; processedfiles < 3; processedfiles++){
File = app.open(new File(filepath + templatefiles[processedfiles]));
var doc = app.activeDocument;
var text = app.activeDocument.layers[0].textFrames.pointText([0, 0]);
app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
text.textRange.characterAttributes.size = 14.5;
text.textRange.characterAttributes.textFont = app.textFonts["SegoeScript-Bold"];
text.contents = personalistation[processedfiles];
text.position = [0,75];
var fname = filenames[processedfiles];
doc.saveAs(new File("E:/Products/scriptoutput/" + fname));
};
};
ProcessFiles();