parenting by scripting
hey pepole ! im new here and new to scripting
I tried to make a simple layer parent on two layers that I duplicate to the first selected layer :
app.project.activeItem.selectedLayers[0].duplicate().name = "one";
app.project.activeItem.selectedLayers[0].duplicate().name = "two";
app.project.activeItem.layer("one").parent = selectedLayers[0];
app.project.activeItem.layer("two").parent = selectedLayers[0];
its doesn't worked. when I do that the After alert me : "selectedLayers is udfinded".
i tried everything and each time its alert another thing , or that its not alert nothing but its doesn't work
I thing that the internet is empty from that information.
also one more question that i got - if i want to make some function that rename the selected layer each time to the same name but its adds a A rising number.
app.project.activeItem.selectedLayers[0].duplicate().name = "shape1";
but in the next time when i will push apply button its will name it "shape2";
thank a lot and sorry about the noob questions