How can I get the art board of the currently selected layer?
You could probably do something like this:
const layer = app.activeDocument.activeLayers[0];
This will get you the current layer. Then, walk up the tree of layers using layer.parent
until you end up with a layer that has a “null” parent.
It’ll look something like this, if you’re debugging with the UXP Developer Tool.
how to know ther layer is a group or a artboard?
by inspecting the Layer Descriptor:
- group: if
layerSection === 'layerSectionStart'
- artboard: if
artboardEnabled
It’s great!
the group out of the artboard: artboardEnabled = false
thank you.