This will split everything onto its own layer in Indesign
var mySels = app.selection.length;
if (mySels == 0) {
alert(“Select the object and Run the script”);
exit(0)
}
else{
while(mySels–){
var objLayer=app.activeDocument.layers.add();
app.selection[mySels].itemLayer = objLayer;
}
}