Answered
Javascript to hide all art layers
Trying to quickly hide all art layers, then show the top layer only. Below is what I have tried, none of which works. Ideally would like to like to avoid a loop to index each layer indivdually and hide it, seems like there has to be a way to select all and hide.
#target photoshop
function main(){
if(!documents.length) return;
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var res = doc.resolution;
var layers = app.activeDocument.layers;
for (var i =0; i<layers.length; i++) {
layers.visible = false;
}
doc.artLayers.visible = false;
doc.artLayers.layers.visible = false; // "returns no such component"
doc.activeLayer = doc.layers[0]
doc.activeLayer.visible = true;
}
main();
