how do I know which layer it is by loading the selection
Hello, everybody!
I am here again.![]()
as shown in the figure,the canvas had a selection is selected,It belongs to the layer 2,A layer has been loaded into the selection,How do I know which layer it is?

ths ccript is set selection,i think There should be a way to get it
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("transparencyEnum"));
r1.putName(stringIDToTypeID("layer"), "Layer 2");
d.putReference(stringIDToTypeID("to"), r1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
}
catch (e) { if (e.number!=8007) { alert("Line: "+e.line+"\n\n"+e,"Bug!",true); throw(e); } }
