REMOVE QUOTES IN TEXT.
hello friends, using csv file populate form in illustrator contains text fields getting texts quotes
example:
instead of> model <is filling> "model" <
how remove quotes, tried using replace method not.
could me?
the script i'm creating this:
#target illustrator
var sourcedoc = app.activedocument;
var afile = file ("~/desktop/teste form com csv.csv");
afile.open("r");
var txtfile = afile.read();
afile.close();
var itext = txtfile.split("\n");
alert(itext)
var multtexts = new array (itext.length-1);
var mytextframe
var dateformat = "dd/mm/yy";
function todaydate()
{
var today = new date();
var day = today.getdate();
var month = today.getmonth() + 1;
var year = today.getyear();
var premon = ((month < 10) ? "0" : "");
var preday = ((day < 10) ? "0" : "");
if(year < 999) year += 1900;
var thedate = dateformat.replace(/dd/,preday+day);
thedate = thedate.replace(/mm/,premon+month);
thedate = thedate.replace(/d/,day);
thedate = thedate.replace(/m/,month);
thedate = thedate.replace(/yyyy/,year);
thedate = thedate.replace(/yy/,year.tostring().substr(2,2));
return thedate;
}
for (i=1; i<itext.length-1; i++) {
t=itext[i].split( ",");
texto=itext[i];
mytextframe=sourcedoc.textframes.getbyname("cliente");
mytextframe.contents=t[0];
mytextframe=sourcedoc.textframes.getbyname("cod");
mytextframe.contents=t[1];
mytextframe=sourcedoc.textframes.getbyname("modelo");
mytextframe.contents=t[2];
mytextframe=sourcedoc.textframes.getbyname("rev");
mytextframe.contents=t[3];
mytextframe=sourcedoc.textframes.getbyname("desenhista");
mytextframe.contents=t[4];
mytextframe=sourcedoc.textframes.getbyname("material");
mytextframe.contents=t[5];
mytextframe=sourcedoc.textframes.getbyname("adesivo");
mytextframe.contents=t[6];
mytextframe=sourcedoc.textframes.getbyname("tubete");
mytextframe.contents=t[7];
mytextframe=sourcedoc.textframes.getbyname("rolos/pacotes");
mytextframe.contents=t[8];
mytextframe=sourcedoc.textframes.getbyname("espv");
mytextframe.contents=t[9];
mytextframe=sourcedoc.textframes.getbyname("esph");
mytextframe.contents=t[10];
mytextframe=sourcedoc.textframes.getbyname("puxada");
mytextframe.contents=t[11];
mytextframe=sourcedoc.textframes.getbyname("carreiras");
mytextframe.contents=t[12];
mytextframe=sourcedoc.textframes.getbyname("nome arquivo");
mytextframe.contents=t[13];
mytextframe=sourcedoc.textframes.getbyname("bobinamento");
mytextframe.contents=t[14];
mytextframe=sourcedoc.textframes.getbyname("data");
mytextframe.contents=todaydate();
}
var destfilepath = "~/desktop/"+t[13]+"_arte.ai"
alert(destfilepath)
function exportfiletoai (dest) {
if ( app.documents.length > 0 ) {
var saveoptions = new illustratorsaveoptions();
var ai8doc = new file(dest);
saveoptions.compatibility = compatibility.illustrator16;
saveoptions.flattenoutput = outputflattening.preserveappearance;
app.activedocument.saveas( ai8doc, saveoptions );
}
}
exportfiletoai (destfilepath);
alert("formulário preenchido com sucesso");
*ggg*
i have answered in other thread question.
try first.
and change line#3 to:
var model_withoutquotmark = model_with_quotmark.replace(/(")([a-z]*\/?[a-z]*)(")/, regexp.$2);
More discussions in Illustrator Scripting
adobe
Comments
Post a Comment