var st=0;
with (app.activeBook) {
for (var i=0; i < bookContents.length; i++) {
var pgs=bookContents[i].documentPageRange.split(",");
for (var j=0; j < pgs.length; j++) {
st+=(pgs[j].split("-").length == 2) ? pgs[j].split("-")[1]-pgs[j].split("-")[0]+1 : 1;
}
}
}
alert(st);