Photoshop JavaScript bug with merge and layer visibility

  • 1
  • Problem
  • Updated 2 years ago
  • Acknowledged
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.
Photo of Andriy Astakhov

Andriy Astakhov

  • 8 Posts
  • 1 Reply Like

Posted 2 years ago

  • 1
Photo of Eric Ching

Eric Ching, Employee

  • 87 Posts
  • 48 Reply Likes

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 report!