Copy link to clipboard
Copied
Hi,
How to move all layers and layersets inside a new layerset named as "Main_Group" using javascript and sctipt listener.
Note: don't change Layers and layerset order.
Thanks
Copy link to clipboard
Copied
Doesn’t simply moving the Layerset itself work?
You may have to link all LayerMasks before, though.
Copy link to clipboard
Copied
If the layerSet does not exist yet you may select layer(Set)s to move and use this code:
sTT = stringIDToTypeID, nme = 'Main_Group';
(ref1 = new ActionReference()).putClass(sTT('layerSection'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1);
(ref2=new ActionReference()).putEnumerated(sTT('layer'),sTT('ordinal'),sTT('targetEnum'))
dsc1.putReference(sTT('from'),ref2);(dsc2=new ActionDescriptor()).putString(sTT('name'),nme)
dsc1.putObject(sTT('using'), sTT('layerSection'), dsc2), executeAction(sTT('make'), dsc1)