Some Missing Keyboard Shortcuts

InDesign boasts many keyboard shortcuts, but some are conspicuously absent (for instance a shortcut for applying semibold), and there are a few I use in other applications which aren’t available in InDesign but which are not difficult to script. Examples of these are some ESTK shortcuts, most notably to swap lines, to duplicate a line or a selection, and to insert tabs at the beginning of all selected paragraphs to indent blocks of text. I’ll describe some of them here.

A Keyboard Shortcut for Semibold

You can apply all kinds of fortmatting to text, such as smallcaps, italic, and bold, but, strangely, not semibold. I always found that a strange omission and scripted a shortcut. Here is the full script (note all the try–catch constructions to make sure that the script doesn’t stop with an error):

try
    {
    switch (app.selection[0].fontStyle)
       {
       case "Regular": case "Roman":
          {
          try {app.selection[0].fontStyle = "Semibold"}
                catch (_) {app.selection[0].fontStyle = "Bold"};
          break
          }
       case "Italic":
          {
          try {app.selection[0].fontStyle = "Semibold Italic"}
                catch (_) {app.selection[0].fontStyle = "Bold Italic"};
          break
          }
       case "Semibold": case "Bold":
          {
          try {app.selection[0].fontStyle = "Regular"}
                catch (_) {app.selection[0].fontStyle = "Normal}";
          break
          }
       case "Semibold Italic": case "Bold Italic":
          {
          try {app.selection[0].fontStyle = "Italic"}
                catch (_) {}
          break
          }
       }
    }
catch(_){}

The script works like other shortcuts: the script toggles roman (or regular) and semibold; it ...

Get Scripting InDesign CS3/4 with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.