SVG to AI

New Here ,
Sep 09, 2022 Sep 09, 2022

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;
}

.......

 

 

TOPICS
Scripting

Views

45

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 09, 2022 Sep 09, 2022

add the following line after opening the file

 

app.executeMenuCommand ("doc-color-cmyk");

Likes

Translate

Translate
Community Expert ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

LATEST

add the following line after opening the file

 

app.executeMenuCommand ("doc-color-cmyk");

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines