With some page items selected, this line:
covers the selected objects. Individual items in the selection are addressed like this:
To process all selected items and place them on another layer, you could do something like this:
for (i = 0; i < app.selection.length; i++)
app.selection[i].itemLayer = "Layer 2"
This is very rudimentary, without any error checking, but it shows you one of the ways of going about it.
Here's a class for InDesign JS that encapsulates the user selection and allows many manipulations:
The “TSelection” class : http://marcautret.free.fr/geek/indd/selection/TSelection.zip
Documentation (in French, sorry!) : http://marcautret.free.fr/geek/indd/selection/
Thanks! That works exactly like I was hoping it would. . . So simple, I just couldn't seem to find it anywhere. Thanks again
to read in english use google translate at