Created
August 17, 2019 18:44
-
-
Save kostimarko/5c5b502e6e1ba003b96c476f1c4cd259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Global Variables to use. | |
var destFolder, sourceFolder, files, fileType, sourceDoc, svgSaveOpts, doc, layers; | |
// The folder where all of the Illustrator files are. | |
sourceFolder = Folder.selectDialog( 'Select the folder with Illustrator files you want to convert to SVG', '~' ); | |
// Function that sets up the exporting process | |
function init(){ | |
// Check to see if sourceFolder has any files in it | |
if(sourceFolder != null){ | |
// Create new array for files to be stored | |
files = new Array(); | |
// Only use file types that are illustrator files | |
fileType = "*.ai"; | |
// Files get save with all of the files in the sourceFolder | |
files = sourceFolder.getFiles(fileType); | |
// Check to see if there are any files in the folder | |
if(files.length > 0){ | |
// Ask for a destination folder | |
destFolder = Folder.selectDialog('Select the folder you want to export files to', '~'); | |
// Loop through files | |
for(var i = 0; i < files.length; i++){ | |
// Save the open file and properties to sourceDoc | |
sourceDoc = app.open(files[i]) | |
doc = app.activeDocument; | |
hideAllLayers(); | |
exportLayers(); | |
sourceDoc.close(SaveOptions.DONOTSAVECHANGES); | |
} | |
} else { | |
alert('There is nothing here') | |
} | |
} else { | |
alert('There are no files here') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment