Hi zimbop,
let's tackle the particular location issue for the zoom.
My idea is to use a unique object in the document, e.g. a rectangle with a unique name, that a script can select and zoom to. Let's say the name of that zoom item should be ZoomCenter.
Best draw out a rectangle on the page you want to zoom to. Could be any size.
Rename the rectangle in the Layers panel to ZoomCenter.
The script code below will identify it by its name, selects it and zooms to it. Then it will be deselected.
Suggestion: You could put the zoom item named ZoomCenter to an extra layer.
Even if you lock the layer the zoom item can be selected by the script.
Even if you set the layer to invisible the zoom item can be selected by the script.
Even if you lock the zoom item the script will work.
Even if you make the item invisible the script will work.
The code below is written in ExtendScript ( JavaScript ) and should work with all versions of InDesign after CS4.
To change the zoom percentage value just edit the number in the line:
var zoomToPercentage = 200 ;
If you want to use a different name for your zoom item, rename the object in the Layers panel and use exactly the same name in the code where it says:
var zoomItemName = "ZoomCenter";
How to work with ExtendScript code see e.g. here:
http://www.indiscripts.com/pages/help#hd0sb2
/**
* @@@BUILDINFO@@@ ZoomToSelectedObjectOnPage-using-activeSpread.jsx !Version! Tue Dec 17 2019 15:34:39 GMT+0100
*/
/*
Written by Uwe Laubender
Posted at Adobe InDesign Forum at:
Automate view
zimbop, Dec 16, 2019
https://community.adobe.com/t5/indesign/automate-view/td-p/10805230
What does the script do?
It zooms to an object in the INDD document that has a unique name.
The object could be anything that could be named in the Layers panel.
A graphic frame, a text frame, a graphic line etc. pp.
The object should not be grouped, anchored or nested otherwise.
Script works with InDesign CS5 version 7 and above.
*/
( function()
{
// TYPE A DIFFERENT VALUE OF ZOOM BELOW:
var zoomToPercentage = 200 ;
// IF YOU WANT TO CHANGE THE NAME OF THE OBJECT DO IT ALSO HERE:
var zoomItemName = "ZoomCenter";
// BEST DO NOT EDIT CODE BELOW.
var min = 5 ;
// Because of a bug we cannot zoom by script to maximum 4000%
var max = 2000 ;
// If zoom percentage is out of range, do nothing:
if( zoomToPercentage < min || zoomToPercentage > max ){ return };
// If no document is open, do nothing:
if( app.documents.length == 0 ){ return };
var targetDoc = app.documents[0];
var zoomItem = targetDoc.pageItems.itemByName( zoomItemName );
// If there is no zoom item found, do nothing:
if( !zoomItem.isValid ){ return };
var zoomItemLockedState = zoomItem.locked ;
var zoomItemVisibleState = zoomItem.visible ;
var targetSpread = zoomItem.parent;
// Make the spread of the target page the active spread:
targetDoc.layoutWindows[0].activeSpread = targetSpread ;
zoomItem.locked = false ;
zoomItem.visible = true ;
// Select the zoom item by script:
// NOTE: Possible even if the layer of the item is locked!
// NOTE: Possible even if the layer of the item is set to invisible!
targetDoc.select( zoomItem );
// Apply the zoom value:
targetDoc.layoutWindows[0].zoomPercentage = zoomToPercentage ;
// Deselect everything:
targetDoc.select( null );
// Reset the values for locked and visible to the item:
zoomItem.locked = zoomItemLockedState ;
zoomItem.visible = zoomItemVisibleState ;
}() )
Regards,
Uwe Laubender
( ACP )