Reply To: CS3 JS – Get all Page Items that have a script label without iterating

Home Page / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / CS3 JS – Get all Page Items that have a script label without iterating / Reply To: CS3 JS – Get all Page Items that have a script label without iterating

#64232
Eugenyus
Member

var doc = app.activeDocument;
var piLabels = doc.pageItems.everyItem().label;
piLabels.sort();
var frstLabel = lastLabel = 0;
do{
while (piLabels[frstLabel] == piLabels[lastLabel+1]){lastLabel++;}
if (lastLabel != frstLabel) {
piLabels.splice(frstLabel, lastLabel-frstLabel+1);
lastLabel = frstLabel;
}
else{
frstLabel++;
}
}while(frstLabel!=piLabels.length-1);
alert(piLabels.join(“n”)); //Lists the labels without having to iterate…

This article was last modified on February 21, 2013

Comments (0)

Loading comments...