I'm currently writing a script (JS) that is to take each page of a PDF document, resize it to predetermined pixel sizes, in different documentModes, in a loop such that PDFOpenOptions.page is equal to a counter starting 1 and keeps going. Is there a object or whatever that tells you the number of pages in the whole document? I figure there must be, since when you open a multipage PDF in Photoshop, it presents the dialog box that shows the total number of pages and allows you to choose X number of total pages. I'd then do the resizing, etc. in a while loop, less than said number plus 1 or something. The script halts after the last page in the PDF document is processed and then Photoshop presents that dialog box to choose the page from the PDF.
If there isn't such a convenient way of achieving this, is there another method or crude hack to end the script?