Here are sample PSD file and simple script that iterates through all top layers and make them invisible. In case there is a LayerSet script call merge() to it before making it invisible. The problem is after calling merge() to LayerSet_1 already processed and invisible Layer_1 become visible again. The issue is only occur if Layer_1 is selected when script is launched. If LayerSet_1 is selected - there are no issues. https://www.dropbox.com/sh/jg7ttctcramooxd/AAD4ZAJXTVi6eKuOTkB9t7hDa?dl=0
Eric D Ching • Adobe Employee, Jan 06, 2017Jan 06, 2017
Hi,
Thanks for the sample image/script, I can reproduce this and will investigate further. One workaround is to set the active layer with the current loop layer:
for (var i = 0; i < doc.layers.length; ++i) { var layer = doc.layers[i]; app.activeDocument.activeLayer = layer; ...
Thanks for the sample image/script, I can reproduce this and will investigate further. One workaround is to set the active layer with the current loop layer:
for (var i = 0; i < doc.layers.length; ++i) { var layer = doc.layers[i]; app.activeDocument.activeLayer = layer; ...