Skip to content

Instantly share code, notes, and snippets.

@cwhitney
Created October 28, 2014 18:44
Show Gist options
  • Save cwhitney/687a17444cd89690200d to your computer and use it in GitHub Desktop.
Save cwhitney/687a17444cd89690200d to your computer and use it in GitHub Desktop.
Rename visible layers in Illustrator
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