Hi, With this post I would like to ask a question. When working with an array of page items, I'm having very strange issues. I need to loop over all page items and when the script label of the page item matches some specifications, I need to move them to another layer. Finding the page items I need and putting them in an array is no problem. But when I start to move the items to another layer, the objects in my array change !!!! I have debugged the script, and the problems occur after the first move to another layer. This is the example code... $.write("------> Script started \n"); var myDoc = app.activeDocument; var myPageItems = myDoc.pages[0].pageItems; var myObjectList = new Array(); for (ii = 0; ii < myPageItems.length; ii++) { if (myPageItems[ii].label != ""){ myObjectList.push(myPageItems[ii]); $.write("> Pushed : " + myPageItems[ii].label + "\n"); } } for (gg = 0; gg < myObjectList.length; gg++) { myObjectList[gg].itemLayer = app.activeDocument.layers.item("Final"); $.write("> Moved : " + myObjectList[gg].label + "\n"); } $.write("------> Script stopped \n"); This is the output ------> Script started > Pushed : Banana > Pushed : Appel > Pushed : Lemon > Moved : Banana > Moved : Banana > Moved : Lemon ------> Script stopped As you can see in the above example, an item with script label "Banana" is only pushed once, but processed twice. The opposite occurs as well. Page Items disappear from the area and are replaced with page items which where not put in the array !!! Pushing the items to the array works well. All records are put in the list correctly. After the first move, the content of the array changes !!! The example files contains 10 page items, and only 3 contain a script label. Does anyone have a solution ?
... View more