-
Notifications
You must be signed in to change notification settings - Fork 16
/
Rename Layers.jsx
30 lines (25 loc) · 921 Bytes
/
Rename Layers.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Generated by CoffeeScript 1.7.1
var LayerRenamer, layerRenamer;
LayerRenamer = (function() {
function LayerRenamer() {
if (app.activeDocument.selection.length > 0) {
this.replacements = [prompt("What would you like to replace?", "Eg: source"), prompt("What would you like to replace it with?", "Eg: replacement")];
this.renameLayers(app.activeDocument.selection);
} else {
alert("Select the layers you would like to be renamed.");
}
}
LayerRenamer.prototype.renameLayers = function(layers) {
var layer, name, _i, _len, _results;
_results = [];
for (_i = 0, _len = layers.length; _i < _len; _i++) {
layer = layers[_i];
layer = layer.parent;
name = layer.name;
_results.push(layer.name = name.replace(this.replacements[0], this.replacements[1]));
}
return _results;
};
return LayerRenamer;
})();
layerRenamer = new LayerRenamer();