Trying to convert all sublayers of my design (with or without children) into a group on its own. You can check on my screens what i have to what i need to obtain.
What i have
What i need
Here is the code i currently have but is not working. I've tried to select each layer as standalone and then group each one:
var docRef = app.activeDocument;
groupLayers(docRef);
function groupLayers(doc) {
for(i=0;doc.layers.length>i;i++){
var currentLayer=docRef.layers[i];
app.executeMenuCommand('group');
}
}