Answered
check if a group is open or closed
I have a small problem
I need to know if a group is open or closed
I put up a small script in uxp
but it tells me that the group is always open even if it is closed,
this is the script.
checkLayerGroupStatus()
async function checkLayerGroupStatus() {
const layers = app.activeDocument.layers;
const groupName = "Color";
const layerGroup = layers.find(layer => layer.name === groupName && layer.layers);
if (!layerGroup) {
showAlert( `Level group "${groupName}" not found`);
return;
}
const isOpen = layerGroup.visible;
if (isOpen) {
showAlert(`The level group "${groupName}" is open.`);
} else {
showAlert( `Level group "${groupName}" is closed.`);
}
}