Making a layer group active

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Kukurykus, Tom, xbytor

Limey
Posts: 4
Joined: Tue Jan 30, 2018 7:51 pm

Making a layer group active

Post by Limey »

I am trying to make layer groups active in order to rename them. I can do it to a layer outside of a group but not to the group itself. It was my understanding that groups were treated the same as the art layers.

Why does the below code only work on art layers and not on layer sets?

Code: Select all

var doc = app.activeDocument;
doc.activeLayer = doc.artLayers.getByName("test");
app.activeDocument.activeLayer.name = "Hi there!"
Thanks,
Limey (Paul)

User avatar
Kukurykus
Posts: 306
Joined: Mon Jul 25, 2016 12:36 pm

Re: Making a layer group active

Post by Kukurykus »

Change 'artLayers' to 'layers' or if you have artLayers and groups with the same name then to 'layerSets'.

Limey
Posts: 4
Joined: Tue Jan 30, 2018 7:51 pm

Re: Making a layer group active

Post by Limey »

Thank you kukurykus! Your answer was just what I needed.

Limey