Does anyone have a suggestion on this?
Is there some way to script what the scroll bar does?
Or is there some way to script something equivalent to the "Page Up" key on the keyboard?
There are no view controls in InDesign like there are in Illustrator where you can pass a center point… What you can do however is mimic the behavior of the app itself… Voom will work about an active document selection… So just place a temp box in the area you wish to see on screen, make it selected, zoom to given percentage and remove box. Its not so elegant but possibly the best work about I can think up to do this… Eg:
var doc = app.documents.add(); var frm = doc.pages.textFrames.add(); var w = doc.documentPreferences.pageWidth; var h = doc.documentPreferences.pageHeight; frm.geometricBounds = [.5, .5, h-.5, w-.5]; frm.contents = "Title"; //frm.paragraphs.appliedParagraphStyle = "Title"; var tmp = doc.pages.rectangles.add(); tmp.move([0,0]); tmp.select(SelectionOptions.replaceWith); app.activeDocument.layoutWindows.zoomPercentage = 250; tmp.remove();
Thanks, Muppet Mark, I really appreciate it.
Your script worked. I just adjusted the position of the rectangle a bit to get things centered better. I changed the move line to read:
Then the script works perfectly. Thanks a lot for your help.