Curiously enough, there doesn't seem to be one specific function for that (which may explain the erratic way InDesign sometimes does this). I can't remember off-hand where I saw this trick, but the following works a treat:
app.layoutWindows.zoomPercentage = app.layoutWindows.zoomPercentage;
-- right after your
Jongware has overlooked the showText() method, which should do the trick:
@Jongware – that's really a cool trick.
I bet it was Dave Saunders back in 2007 or earlier… (but have no proof for that).
The usage of zoomPercentage with a fixed value like 2000 to center a single found glyph is documented in 2005 by Martin Fischer in the InDesign subforum at hilfdirselbst.ch.
Ariel, I just knew there was something like that -- I was searching for the exact name just the other day and could not find it ... in CS4. This method was introduced in CS5, one of the very few improvements not immediately related to EPubs and RTL.
Was it CS5? All I know is that one day (I guess after the CS6 upgrade) I was browsing through the DOM when I bumped into it, and I said to myself, "why have I never used that before!"
@Ariel – thank you for pointing at showText().
And yes, it was introduced in InDesign CS5.
But unfortunately it is not configurable, if it comes to something like zoom percentage.
Thanks, everyone, for the great discussion. showText() did the trick, since there's no need to change the zoom percentage in this case. When there is I'll give Jongware's solution a try.