Last active
May 19, 2016 16:26
-
-
Save shaneparsons/1717f21a757f24fb4559 to your computer and use it in GitHub Desktop.
Illustrator Script - Batch Export Symbols as PNGs
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 doc = app.activeDocument; | |
var symbolCount = doc.symbols.length; | |
if (symbolCount >= 1) { | |
if (confirm("Are all your layers hidden?")) { | |
// choose directory | |
var dest = Folder(doc.path).selectDlg(); | |
// folder chosen | |
if (dest) { | |
// create temp layer | |
doc.layers.add(); | |
// loop through symbols | |
for (var i = 0; i < doc.symbols.length; i++) { | |
// place a symbol instance - temp | |
var symbol = doc.symbolItems.add(doc.symbols[i]); | |
// assign name | |
var filename = (doc.symbols[i].name) | |
// export symbols | |
savePNG(dest, filename); | |
// delete temp symbol instance | |
symbol.remove(); | |
} | |
// remove temp layer | |
doc.layers[0].remove(); | |
} | |
} | |
function savePNG(dest, filename) { | |
// save options | |
var type = ExportType.PNG24; | |
var options = new ExportOptionsPNG24(); | |
options.transparency = true; | |
// file | |
var file = new File(dest + "/" + filename); | |
// export | |
doc.exportFile(file, type, options); | |
} | |
} else { | |
alert("You don't have any symbols in this document"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This script seems to have issues since Illustrator added dynamic symbols. I wouldn't recommend using it.