Hi,
Some modifications:
zoomToScale( Number(prompt("Set a zoom scale (5-4000)")) ); function zoomToScale(myScale) { if (isNaN(myScale) || myScale > 4000 || myScale < 5) myScale = 100; var window = app.activeWindow, mDoc = app.activeDocument, mZeroPoint = mDoc.zeroPoint, mHorizViewPrefs = mDoc.viewPreferences.horizontalMeasurementUnits, mActivePage = window.activePage, theRec, mTopCenter; mDoc.zeroPoint = [0,0]; mDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points; theRec = mActivePage.rectangles.add(); mTopCenter = (mActivePage.bounds[3] - mActivePage.bounds[1]) / 2; theRec.move(undefined,[mTopCenter,0]); window.zoom(ZoomOptions.fitSpread); window.zoomPercentage = myScale; app.selection = theRec; theRec.remove(); mDoc.zeroPoint = mZeroPoint; mDoc.viewPreferences.horizontalMeasurementUnits = mHorizViewPrefs; }
Jarek