Check which Layer in this group is visible and store it's name as variable
Hello All
does anyone have a script available that checks which Subgroup (or layer) in GROUP A is visible and store it's name as variable to use it later in the script?
1. Checking GROUP A which layer or group inside it is visible (will be only one at a time).
2. Storing the name of the visible group/layer as variable.
3. use this variable (together with others) as name for the exported file.
I have a script that checks if a given layer name is visible, but i would want to check a group for a visible layer or subgroup.
- var doc = app.activeDocument
- var layersToTargetNameArray = ["Background", "Artwork", "diecut", "size", "sign of panel"];
- for (var i = 0, il = doc.layers.length; i < il; i++) {
- var curLayer = doc.layers;
- for (var j = 0, jl = layersToTargetNameArray.length; j < jl; j++) {
- if (curLayer.name == layersToTargetNameArray
) { - // --------------------------------------------
- // do something if layer name found
- // --------------------------------------------
- curLayer.visible = false; // basic example
- } else {
- // --------------------------------------------
- // do something else if layer name not found
- // --------------------------------------------
- }
- }
- }
Thanks everyone.
