var s=app.activeDocument.activeLayer.pageItems app.selection=null for (var i = 0; i < s.length; i++){ s[i].selected=true }