John, hm, I don't think your untested script will work in a predictable way. Technically it will work a bit. Just tested it. But: 1. if you loop from index 0 to the end, even if you loop from the end to index 0 you will mess the index of the pageItems when moving them to a different page => I recommend grouping all pageItems on the specified layer, so that we have to move only one pageItem, the new group 2. problem with move() to another page is, that you cannot retain the original page coordinates of the moved object, it will get 0,0 coordinates automatically => we have to store the coordinates of the group first, then move, then apply the old coordinates 3. in a real-world scenario we should deal with the possibility of locked pageItems 4. Furthermore we have to make sure that the layer is not locked The following example will unlock all pageItems on that layer and will lock them after they are moved: //Move all objects on a layer of a page to a different page var d=app.activeDocument, src=d.pages[0], dst=d.pages[1], layer=d.layers.itemByName("Layer 2"), i; var myItemsToMove = new Array(); var myItemsLocked = new Array(); for (i=0; i<src.pageItems.length; i++) { if (src.pageItems.itemLayer === layer) { if(src.pageItems.locked){ myItemsLocked.push(src.pageItems.id); src.pageItems.locked=false; } myItemsToMove.push(src.pageItems); } } //Check, if layer is locked: if(layer.locked){ var layL = true; layer.locked=false; }; // create a group on the source page: var newGroup = src.groups.add(myItemsToMove); var gB = newGroup.geometricBounds; //We have to move only ONE object, the new group //To the destination page newGroup.move(dst); //To the old coordinates newGroup.move(undefined,[gB[1],gB[0]]); //Restore the state of the pageItems //Ungroup them once: newGroup.ungroup(); //Relock the former locked objects: for(n=0;n<myItemsLocked.length;n++){ d.pageItems.itemByID(myItemsLocked ).locked=true; }; //Relock layer if it was locked: if (layL){layer.locked=true}; Uwe
... View more