I have a function to select a layer inserted in the function as the argument, however, this takes the layer name and ID to select the layer, the problem is that if I have two or more layers with the same name, the function always select the same layer, even if I insert another layer inside that has the same name:
async function selectLayer(l) {
await batchPlay(
[
{
_obj: "select",
"_target": [
{
"_ref": "layer",
"_name": l.name
}
],
makeVisible: false,
layerID: [l.id],
_options: {
dialogOptions: "dontDisplay"
}
}
], {});
}
How could I select a layer by only the ID? Is it possible? As the Id is unique to the layer inside the document I think this would be a better solution for my problem.
Thanks!