Optimize Your Puppeting Projects: Scripts to Remove 'Copy' from Layer Names in PS ans Ai
When working on digital puppet creation in both Adobe Photoshop and Illustrator, it's common to find ourselves in a scenario where we've duplicated various layers and layer groups. This practice is essential for experimenting with different design elements without losing the original work. However, this often results in a large number of layers with the suffix "copy" in their names, like "Layer 1 copy", "Layer 1 copy 2", and so on. This can make our layer panel messy and confusing, complicating efficient project management.
To solve this issue, I've created two simple yet powerful scripts that will automatically remove the word "copy" and any subsequent text from your layer names, in both Adobe Photoshop and Illustrator. These scripts will allow you to quickly clean up your layer panels, making your workflow cleaner and more organized.
Script for Adobe Illustrator:
The following script for Illustrator searches through all the layers in your document and removes the string "copy" and anything that follows. Simply copy and paste this code into a new text file, save it with the .jsx extension, and run it from Illustrator by going to File > Scripts > Other Script....
// Aquest script elimina la cadena "copy" i tot el que segueixi en els noms de les capes
function removeCopyFromLayerNames(layer) {
for (var i = 0; i < layer.layers.length; i++) {
var subLayer = layer.layers[i];
// Elimina la cadena "copy" i tot el que segueixi
subLayer.name = subLayer.name.replace(/copy.*/, '');
// Recursivament actualitza les subcapas
removeCopyFromLayerNames(subLayer);
}
}
if (app.documents.length > 0) {
var doc = app.activeDocument;
removeCopyFromLayerNames(doc);
alert("Layers have been updated!");
} else {
alert("No hi ha cap document obert.");
}
Script for Adobe Photoshop:
This script for Photoshop does the same, but is tailored for the Photoshop environment. Save the following code as a .jsx file and run it from Photoshop via File > Scripts > Browse....
// Aquest script elimina la cadena "copy" i tot el que segueixi en els noms de les capes en Photoshop
function removeCopyFromLayerNames(layerSet) {
for (var i = 0; i < layerSet.layers.length; i++) {
var layer = layerSet.layers[i];
// Comprova si la capa és un grup (LayerSet)
if (layer.typename == "LayerSet") {
removeCopyFromLayerNames(layer);
} else {
// Elimina la cadena "copy" i tot el que segueixi
layer.name = layer.name.replace(/copy.*/, '');
}
}
}
if (app.documents.length > 0) {
var doc = app.activeDocument;
removeCopyFromLayerNames(doc);
alert("Les capes han estat actualitzades!");
} else {
alert("No hi ha cap document obert.");
}
With these scripts, you can keep your puppeting projects more organized and efficient. I hope these scripts help improve your workflow and keep your design projects neat and orderly. Download them today and start optimizing your design projects!
