Cheers,
I've got a spread with one page. Two page objects (a polygon and an rectangle) on the page, and one rectangle object outside the page. I'm trying to find the object not associated with the page, using two arrays: array1 containing doc.spread.allPageItems, and array2 containing doc.page[counter].allPageItems.
So I go look for the object using for in loops. But no matter what I try I'm only able to find the two objects the arrays have in common. Sigh
Looking for a little javascript assistance..
var oDoc = app.activeDocument; var spreadItems = []; var pageItems = []; var DeleteTheseItems = []; // loop through spreads for ( var aCounter = 0; aCounter < oDoc.spreads.length; aCounter++ ) { var oSpread = oDoc.spreads[aCounter]; // loop through spread items for ( var bCounter = 0; bCounter < oSpread.allPageItems.length; bCounter++ ) { var oSpreadItem = oSpread.allPageItems[bCounter]; spreadItems.push(oSpreadItem); // 3 objects gets pushed } // loop through spreads pages for ( var cCounter = 0; cCounter < oSpread.pages.length; cCounter++ ) { var oPage = oSpread.pages[bCounter]; // loop through page items for ( var dCounter = 0; dCounter < oPage.allPageItems.length; dCounter++ ) { var oPageItem = oPage.allPageItems[dCounter]; pageItems.push( oPageItem ); // 2 objects gets pushed } // cCounter } // bCounter } // aCounter alert("spreadItems: "+spreadItems.toSource()); // 3 objects total: 1 outside page, 2 on the page alert("pageItems: "+pageItems.toSource()); // 2 objects on page for ( spreadItem in spreadItems ) { for ( pageItem in pageItems ) { if ( spreadItems[spreadItem] == pageItems[pageItem] ) { DeleteTheseItems.push(spreadItems[spreadItem]); // the 2 objects in common gets pushed break; } } } alert(DeleteTheseItems.toSource())