Copy link to clipboard
Copied
i got this script that allow me to export range of artboards to SVG files , but I cant find how to export each artboard with its name or an array of names
var docRef = app.activeDocument;
var path = docRef.path;
function exportFileToSVG (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsWebOptimizedSVG();
var type = ExportType.WOSVG;
var fileSpec = new File(dest);
exportOptions.saveMultipleArtboards = true;
exportOptions.artboardRange = '1-2';
exportOptions.coordinatePrecision = 2;
exportOptions.fontType = SVGFontType.OUTLINEFONT;
exportOptions.svgMinify = true;
exportOptions.svgId = SVGIdType.SVGIDREGULAR;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}
exportFileToSVG('~/Desktop/blah.svg');
var ABs = app.activeDocument.artboards;
for (var i = 0; i < ABs.length; i++) {
ABs.setActiveArtboardIndex(i);
exportFileToSVG("~/Desktop/" + ABs[i].name + ".svg");
}
function exportFileToSVG (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsSVG();
var type = ExportType.SVG;
var fileSpec = new File(dest);
exportOptions.saveMultipleArtboards = true;
exportOptions.artboardRange = '1-2';
exportOptions.coordi
...
Copy link to clipboard
Copied
What exactly is the problem? You iterate through the artboards, make each artboard active in turn and call the function with the active artboard's name added to the path. Or am I misunderstanding the question?
Copy link to clipboard
Copied
hey @femkeblanco hope you have an amzing day , the problem is thate i wont the artboard exported with her name I misunderstanding btw
Copy link to clipboard
Copied
var ABs = app.activeDocument.artboards;
for (var i = 0; i < ABs.length; i++) {
ABs.setActiveArtboardIndex(i);
exportFileToSVG("~/Desktop/" + ABs[i].name + ".svg");
}
function exportFileToSVG (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsSVG();
var type = ExportType.SVG;
var fileSpec = new File(dest);
exportOptions.saveMultipleArtboards = true;
exportOptions.artboardRange = '1-2';
exportOptions.coordinatePrecision = 2;
exportOptions.fontType = SVGFontType.OUTLINEFONT;
exportOptions.svgMinify = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}
Copy link to clipboard
Copied
this is working fine but i still git thise under scoers when its rebeat the artboard name again
var ABs = app.activeDocument.artboards;
for (var i = 0; i < ABs.length; i++) {
ABs.setActiveArtboardIndex(i);
exportFileToSVG("~/Desktop/" + ABs[i].name + ".svg");
}
function exportFileToSVG (dest) {
if ( app.documents.length > 0 ) {
var exportOptions = new ExportOptionsSVG();
var type = ExportType.SVG;
var fileSpec = new File(dest);
exportOptions.saveMultipleArtboards = true;
exportOptions.artboardRange = (i+1).toString();
exportOptions.coordinatePrecision = 2;
exportOptions.fontType = SVGFontType.OUTLINEFONT;
exportOptions.svgMinify = true;
app.activeDocument.exportFile( fileSpec, type, exportOptions );
}
}
i need to enter this svg's to another app thats way i need there names to be clean as i set them unless is not going to work
Copy link to clipboard
Copied
Copy link to clipboard
Copied
oh , i just know how (: thank you soo much , i just had to turn off the save multiple artboards option this is how i get clean file name @femkeblanco