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: xbytor, DavideBarranca, Paul MR

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

Making a layer group active

Post by Limey » Fri Jul 26, 2019 12:05 am

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: 195
Joined: Mon Jul 25, 2016 12:36 pm

Re: Making a layer group active

Post by Kukurykus » Wed Jul 31, 2019 1:22 am

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 » Thu Aug 22, 2019 7:21 am

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

Limey

Post Reply