Saturday, November 19, 2011

Navigating by Page

Moving through a document's pages is a straight-forward process. The first page, whether a body, master or reference, is a document property:
  • FirstBodyPageInDoc
  • FirstMasterPageInDoc
  • FirstRefPageInDoc
As pages are ordered, you can also start at the end:
  • LastBodyPageInDoc
  • LastMasterPageInDoc
  • LastRefPageInDoc
Each page has a PageNext and PagePrev property that allows you to move to the next page in the sequence. Remember that these are page properties.

Once you locate the page of interest, you can make it the current page. The following script makes the first reference page the active page.

var doc, firstRef;
doc = app.ActiveDoc;
firstRef = doc.FirstRefPageInDoc;
doc.CurrentPage = firstRef;


If you run this script on the Portrait template, the following page will appear on screen:


No comments:

Post a Comment