Skip to content

Instantly share code, notes, and snippets.

@dokluch
Created February 20, 2015 06:34
Show Gist options
  • Save dokluch/c997f1fd59447fa698d1 to your computer and use it in GitHub Desktop.
Save dokluch/c997f1fd59447fa698d1 to your computer and use it in GitHub Desktop.
/*
*Snippet to change target name project-wise.
*Comp names and layer names are going to be affected.
*I believe there are going to be problems with expressions.
*Though I'm not sure
*
*CC-BY, Nik Ska, 2015
*/
var wrongName = "СС";
var targetName = "WATWAT";
var howMuch = 0;
app.beginUndoGroup("Changeallnames");
for(var i = app.project.numItems; i > 0; i--){
var thisItem = app.project.item(i);
if(thisItem.name == wrongName){
thisItem.name = targetName;
howMuch++;
}
if(thisItem instanceof CompItem){
for(var c = thisItem.layers.length; c > 0; c--){
var thisLayer = thisItem.layers[c];
if(thisLayer.name == wrongName){
thisLayer.name = targetName;
thisLayer.selected = true;
thisItem.openInViewer();
howMuch++
}
}
}
}
alert("Changed " + String(howMuch) + " names");
app.endUndoGroup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment