Copy link to clipboard
Copied
Hi!
Trying to not remove some layers if name contains, I need some help
What regex needed for the "Notmatch" ?
app.activeDocument.layerSets[0].layers[i].name.match(Notmatch)
#target photoshop
var docRef = app.activeDocument;
var layName = docRef.activeLayer.name
var Notmatch = "Invert"
for(var i = 0; i < app.activeDocument.layerSets[0].layers.length ; i++) {
if(app.activeDocument.layerSets[0].layers[i].name!=layName && app.activeDocument.layerSets[0].layers[i].name.match(Notmatch)){
app.activeDocument.layerSets[0].layers[i].remove();
}
}
I think I found it 🙂
#target photoshop
var docRef = app.activeDocument;
var layName = docRef.activeLayer.name
var Notmatch = "Invert"
for(var i = 0; i < app.activeDocument.layerSets[0].layers.length ; i++) {
if(app.activeDocument.layerSets[0].layers[i].name!=layName && app.activeDocument.layerSets[0].layers[i].name.indexOf(Notmatch)){
app.activeDocument.layerSets[0].layers[i].remove();
}
}
Copy link to clipboard
Copied
I think I found it 🙂
#target photoshop
var docRef = app.activeDocument;
var layName = docRef.activeLayer.name
var Notmatch = "Invert"
for(var i = 0; i < app.activeDocument.layerSets[0].layers.length ; i++) {
if(app.activeDocument.layerSets[0].layers[i].name!=layName && app.activeDocument.layerSets[0].layers[i].name.indexOf(Notmatch)){
app.activeDocument.layerSets[0].layers[i].remove();
}
}