Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Script to rename selected layers and layer sets with a prepend of user-input characters

Explorer ,
Oct 24, 2019 Oct 24, 2019

Hello all,

    I've got this bit of code here which will rename a layer, whether it's an art layer or a layer set, by prepending a user-input character string. I'd like it to apply this user-input character prepend rename to all active layers currently selected in the document. Any help is greatly appreciated. Thank you!

 

 

 

TOPICS
Actions and scripting
688
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Explorer ,
Oct 24, 2019 Oct 24, 2019

var aDoc = activeDocument;
var actLay = aDoc.activeLayer.layer;
if (actLay.typename == "ArtLayer") {
var newName = prompt ("Please type in current R#", actLay.name, "Rename");
try {actLay.name = newName + " • " + actLay.name;} catch (e) {};
} else {
(actLay.typename == "LayerSet") {
var newName = prompt ("Please type in current R#", actLay.name, "Rename");
try {actLay.name = newName + " • " + actLay.name;} catch (e) {};
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2019 Oct 25, 2019
LATEST

This is not a direct answer, however, while on the general topic there is this script from Paul Riggott:

 

https://raw.githubusercontent.com/Paul-Riggott/PS-Scripts/master/Layer%20Name%20Edit.jsx

 

It can rename selected layers and layer sets. As it uses a regular expression based find/replace, if your layers have different names that will be renamed to the same name, use the following as a wildcard for the search:

 

.+

 

(period plus-sign)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines