Copy link to clipboard
Copied
I have been trying to clean up the layers in a document(s) with the following script. It all works except for the UPPERCASE line.
Does anyone have any ideas?
function standardizeLayerNames()
{
var myDoc7=app.activeDocument
var myLayerCount7 = myDoc7.layers.length
for(var myCounter7 = 0; myCounter7 < myLayerCount7; myCounter7++){
var selectLayer7 = myDoc7.layers[myCounter7]
selectLayer7.visible=true
selectLayer7.locked=false
selectLayer7.name = selectLayer7.name.replace ("-", "_")
selectLayer7.name = selectLayer7.name.replace(" ", "_")
selectLayer7.name = selectLayer7.name.CaseChangeType.UPPERCASE
}
}
function standardizeLayerNames() {
var myDoc7 = app.activeDocument;
var myLayerCount7 = myDoc7.layers.length;
for (var myCounter7 = 0; myCounter7 < myLayerCount7; myCounter7++) {
var selectLayer7 = myDoc7.layers[myCounter7];
selectLayer7.visible = true;
selectLayer7.locked = false;
selectLayer7.name = selectLayer7.name.replace(/[- ]/g, "_").toUpperCase();
}
}
Copy link to clipboard
Copied
function standardizeLayerNames() {
var myDoc7 = app.activeDocument;
var myLayerCount7 = myDoc7.layers.length;
for (var myCounter7 = 0; myCounter7 < myLayerCount7; myCounter7++) {
var selectLayer7 = myDoc7.layers[myCounter7];
selectLayer7.visible = true;
selectLayer7.locked = false;
selectLayer7.name = selectLayer7.name.replace(/[- ]/g, "_").toUpperCase();
}
}
Copy link to clipboard
Copied
moluapple
Thank you very much. Would you happen to have a resourse that I could reference that describes the search string and how to set it up?
If not, this still saves me several hours and multiple headaches...
Copy link to clipboard
Copied
search for Javascript Regular Expressions or RegExp Object
Copy link to clipboard
Copied
http://www.regular-expressions.info/reference.html
are the ones I use most…