Copy link to clipboard
Copied
Hi guys how are you?
My script reads an SVG file and converts it to an AI file. So far everything is working, but I need this AI file to be in CMYK color mode. Currently the AI files are being generated in RGB format. Does anyone have any suggestions to solve this problem?
....
var inputFolder = Folder.selectDialog ("Select a folder to process...");
if (inputFolder != null){
var fileandfolderAr = scanSubFolders(inputFolder, /\.(svg)$/i);
var fileList = fileandfolderAr[0];
}
for (var i=fileList.length-1; i>=0; i--){
app.open(fileList[i]);
var doc = app.activeDocument;
var fn = doc.fullName.toString();
var docName = fn.substring(fn.lastIndexOf("/")+1,fn.length).replace(/\.[svg]{2,3}/i,"");
var savePath = fn.substring(0,fn.lastIndexOf("/")+1);
var ext;
try{
//save the ai file:
ext = ".ai";
doc.saveAs(File(savePath + docName + ext));
doc.close(SaveOptions.DONOTSAVECHANGES);
} catch(e){
alert('Erro: " ' + doc.name + '" failed.\n' + e.message);
return;
}
.......
add the following line after opening the file
app.executeMenuCommand ("doc-color-cmyk");
Copy link to clipboard
Copied
add the following line after opening the file
app.executeMenuCommand ("doc-color-cmyk");