Skip to main content
Carson Jones
Known Participant
July 30, 2026
Question

SCRIPT - LAYER (INCL NAME) TO GROUP...

  • July 30, 2026
  • 1 reply
  • 10 views

I’ve created a script that will create a layer group from a selected layer and the group will take on the name of the selected layer. Sharing here for anyone that can use it. It’s very handy.

var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("layerSection"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("from"), r1);
var d1 = new ActionDescriptor();
d1.putString(stringIDToTypeID("name"), app.activeDocument.activeLayer.name);
d.putObject(stringIDToTypeID("using"), stringIDToTypeID("layerSection"), d1);
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);

 

Note: For anyone who hasn’t used scripts in Photoshop you need to past the above text into a simple text file (e.g. using an app like Notepad, Notepad ++, etc.) and change the file extension tag to .jsx - load this file as a script in Photoshop and you’re good to go.

    1 reply

    Stephen Marsh
    Community Expert
    Community Expert
    July 31, 2026

    Thanks for sharing!

     

    More here on saving and running scripts:

     

    https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html