Blog

8 March 2019

How to make InDesign centre on selection with a keystroke

Maybe it’s a throwback to when PC-XT keyboards had function keys down the left-hand side rather than across the top, and you could do everything in WordPerfect 4.2 with just one hand, but I’ve always preferred to type keystrokes instead of using the mouse, not least because it’s quicker and you don’t have to look at what you’re doing.

So having started a search in InDesign, I’d much rather use the Find Next keystroke (on a Mac, ⌥⌘F or cmd-alt-F) than keep clicking the Find button on the Find/Change panel. This is especially the case when I have no particular search-and-replace in mind, for example when simply checking italics at the start of a typesetting job.

InDesign only presents a search result in the middle of the active window when it has to redraw the page. Otherwise, if the next search result is already in view, it merely moves the selection highlight across the screen.

However, when that comes right at the bottom of the screen, and especially at the end of a line as here, I need more context to ensure I’m evaluating the search result properly:

Unfortunately, there’s no command in InDesign to just move the focus of your attention to the centre of the screen, like this:

Sure, you can scroll with the mouse, or pan around with the Hand Tool, but that’s a woefully inefficient loss of focus if the aim is to remain keyboard-centric.

One way to centre the selection in the middle of the screen is to zoom in or out, but that still means zooming the other way to return to your original zoom setting. Even then, that’s only practical if you’re already working at one of InDesign’s pre-set zoom increments, such as 150% or 200%.

It’s also two keystrokes (⌘= and ⌘–) not one, and the constant resizing is hardly soothing on the eyes after prolonged usage.

However, there is a way to invoke the zoom centring behaviour, without changing the zoom resolution, by means of an InDesign script.

The following AppleScript (Mac-only I’m afraid, but Windows users can apply the same methodology in JavaScript) retrieves the current zoom setting, and then tells InDesign to zoom the active window to that setting. As there’s no change in zoom value, the only effect is to move the highlighted selection to the centre of the screen:

tell application "Adobe InDesign CC 2019"
    set current_zoom to zoom percentage of active window
    set zoom percentage of active window to current_zoom
end tell

To save this and use it (on a Mac):

  1. Highlight and copy the script code above
  2. Open Script Editor (Applications > Utilities > Script Editor.app)
  3. Make a new file, if one hasn’t been started on opening Script Editor
  4. Paste the script code into the new file
  5. Save the file in your InDesign user scripts folder
  6. Assign the script an InDesign keyboard shortcut

I’ve set my keyboard shortcut to ⌥⌘9 (cmd-alt-9), so when I’m repeatedly keying ⌥⌘F for Find Next and need to centre the highlight, my left hand stays put and it’s just my right forefinger moving between F and 9.

You may think this is all a bit obsessive but, believe me, on a 500-page, 600,000-word book such as the one shown here, with over 26,000 instances of italics to check, and more than 15,000 instances of bold, the time savings quickly add up!

Share or comment via Twitter

To book BBR for your next project, get in touch on bbr@bbr-online.co.uk or +44 (0)1246 271662.