Could someone please sketch out this simple script for me?
Could someone please sketch out a simple java script for me. I will have a document with one background
layer and a layer set (group) called "Analyze" that consists of 63 adjustment layers. The layer names in that "Analyze" group(folder) will be
"01" ...through "63" with 01 on the bottom and 63 at the top. Initially, all of the adjustment layers will be invisible and the
group will be closed (not expanded). I need a simple script that will check for the first invisible layer in that group
and make it visible without selecting that layer nor expanding the group. The script has to check
for the first invisible layer every time it runs because other actions may have turned off a layer in the set.
The point of this is so I can hotkey flipping on the layers one at a time without expanding the set or
changing focus off the background. It seems it should be a simple loop, but I just can't wrap my head
around all the objects (e.g. Layer as opposed to Layers and Artlayer as opposed to Artlayers)
and the constants constants.
for (i = 63; i>0; i--){ /* I have found layer indexes 0 are the topmost layer */
if( layerset == INVISIBLE){
layerset = VISIBLE;
break;
}
}
Could someone please write me a simple script that would do this?
Edit I found this and its very close to what I need:
var doc = app.activeDocument;
for(var i = 0 ; i < doc.layers.length;i++){
doc.layers.visible = (i % 2 == 0);
}
From here : Function to show/hide layer with Photoshop script (JSX) - Stack Overflow
In my case I would rewrite it to this
for(var i = 62; i >=0; i--){
if( !doc.layers.visible){
doc.layers.visible =TRUE;
break;
}
}
My problem is I just need to traverse the layers in my layerset "Analyze"
How do I reference just those? Is there a doc.layersets["Analyze"].layers.visible = TRUE?
Message was edited by: Shawn Laughlin To add more information
