Created
October 28, 2014 18:44
-
-
Save cwhitney/687a17444cd89690200d to your computer and use it in GitHub Desktop.
Rename visible layers in Illustrator
This file contains hidden or 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 prefix = Window.prompt ("Rename prefix", "", "By Sharkbox"); | |
function transverseTree(layer){ | |
if( layer.visible ){ | |
layer.name = prefix + "-" + layer.name; | |
} | |
for( var i=0; i<layer.layers.length; i++){ | |
transverseTree( layer.layers[i] ); | |
} | |
} | |
if( prefix != null){ | |
for( var i=0; i<doc.layers.length; i++){ | |
transverseTree( doc.layers[i] ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment