Hi,
the code below should
1) open a INDD file
2) traverse all pages
3) grab all the rectangles from that page
4) and delete them.
things that work:
the script traverses trough all the pages (4 pages)
he finds all the rectangles on that page
but then:
when there are for example 5 items on that page, he shows me in that there are 5 items on that page, but when he goes in the second while loop, he only does it 3 times, when he actually should loop 5 times... that's so strange.
Result: a indd file with only a few rectangles removed, and some remain...
So, if someone could help me/show me, that would be awesome!
Thanks !
Tha code!
destination = app.open(File("/Users/anders/Desktop/46a93e71-b6bc-477f-abfd-3221f527dc44/VerticalDMA5.in dd"));
destination.documentPreferences.facingPages = false;
var pages = destination.pages;
var page;
var pageItems;
var v = 0;
var z = 0;
$.writeln ("pages = " + pages.length)
while(z < pages.length) {
page = pages[z];
pageItems = page.rectangles;
$.writeln ("number of items on page = " + pageItems.count())
while(v < pageItems.length) {
pageItem = pageItems[v];
$.writeln("PageItem: "+pageItem+" ID: "+pageItem.id);
pageItem.remove();
v = v + 1;
}
v = 0;
z = z + 1;
}