Tuesday, November 15, 2005


Select and Display

One of the challenges of complex scripts is showing the user object in a document when things go wrong. For example, say you have a completely overset cell in a table or a text frame that meets some criteria of interest. Well, here's a little function that will do the job:
function selectIt(theObj) {
  // Selects object, turns to page and zooms in on it
  app.activeWindow.zoom = ZoomOptions.fitPage;
  app.activeWindow.zoomPercentage = 200
Why does this work? Well, making the selection makes the page that the selection is on the active page. That causes the zoom command to operate on that page, no matter which page might previously have been active. By zooming to fitPage, we make sure that the selected object (or text) is visible in the window so that zooming in to 200 does so with the selection centered.

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?