Created
February 25, 2015 23:16
-
-
Save rewfergu/fda299eea13628cde6c6 to your computer and use it in GitHub Desktop.
Convert Illustrator files to Symbols
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
var sourceFolder, | |
files, | |
fileType, | |
sourceDoc, | |
sourceArtwork, | |
symbolRef; | |
//documents.add(); | |
var docRef = documents[0]; | |
// Select the source folder. | |
sourceFolder = Folder.selectDialog( 'Select a folder...', '~' ); | |
// If a valid folder is selected | |
if ( sourceFolder != null ) | |
{ | |
files = new Array(); | |
fileType = prompt( 'Select type of Illustrator files to you want to process. Eg: *.ai', ' ' ); | |
// Get all files matching the pattern | |
files = sourceFolder.getFiles( fileType ); | |
if ( files.length > 0 ) | |
{ | |
for ( i = 0; i < files.length; i++ ) { | |
sourceDoc = new File(files[i]); | |
sourceArtwork = docRef.groupItems.createFromFile(sourceDoc); | |
symbolRef = docRef.symbols.add(sourceArtwork); | |
symbolRef.name = sourceDoc.name; | |
} | |
alert( 'symbols converted '); | |
} else { | |
alert( 'No matching files found' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment