Skip to main content
Participant
March 30, 2012
Answered

Custom zoom script

  • March 30, 2012
  • 1 reply
  • 4777 views

I found a script by Jongware at InDesign Secrets for fitting on a page and then zooming:

app.layoutWindows[0].zoom(ZoomOptions.FIT_PAGE);

try {app.layoutWindows[0].zoomPercentage = Number(app.activeScript.name.match(/\d+/)[0]);} catch (e) {};

I modified it to fit on the spread and then zoom:

app.layoutWindows[0].zoom(ZoomOptions.FIT_SPREAD);

try {app.layoutWindows[0].zoomPercentage = Number(app.activeScript.name.match(/\d+/)[0]);} catch (e) {};

It works great for my needs if no items are selected on the spread.  However, the problem is that when a frame(s) is selected it doesn't center the spread anymore.  The center point (vertically and horizontally) becomes the center of the frame or group of frames selected.  Would anyone know how to modify this script so that it it is frame selection independant?  Thanks.

This topic has been closed for replies.
Correct answer John Hawkinson

Isn't this a problem with the original script? InDesign centers the zooming around the current selection.

You can save the selection, clear it, and then restore it afterwards. Add at the beginning (untested):

var oldsel = app.selection;

app.select(null);

and at the end:

app.select(oldsel);

1 reply

John Hawkinson
John HawkinsonCorrect answer
Inspiring
March 30, 2012

Isn't this a problem with the original script? InDesign centers the zooming around the current selection.

You can save the selection, clear it, and then restore it afterwards. Add at the beginning (untested):

var oldsel = app.selection;

app.select(null);

and at the end:

app.select(oldsel);

Participant
March 30, 2012

Thank you John.  Works great.

I'll add for anyone refering to this in the future that the name of the script sets the zoom level, ie...    zoom110.jsx will zoom to 100%

April 4, 2012

Don't you mean zoom110.jsx will zoom to 110% ?? (not 100%?)