Customizing Pages ’09: Shortcuts to toggle All Caps and Small Caps

Posted by Pierre Igot in: Pages
April 7th, 2010 • 4:59 pm

Like Microsoft Word, Pages ’09 comes with a built-in character formatting option called “All Caps” (in the “Format” menu, under “Font › Capitalization”).

The main benefit of having a formatting option for this as opposed to a command that just changes the case (as if you’d typed with CapsLock on) is that it is easily reversible (and it can also be included in a character style or paragraph style definition).

The reversibility benefit makes it all the more puzzling, then, that in Pages Apple’s engineers chose to make the “All Caps” menu item a one-way command only.

In other words, if you select a word that is in lowercase and you select “All Caps,” Pages changes the word’s character formatting to all caps. But if you select a word that already has the “All Caps” formatting option and you want to remove that formatting option (i.e. change it back to lowercase), you cannot select the same “All Caps” menu item again. Instead, you have to select a different menu item under “Font › Capitalization,” which is labelled “None.”

This is especially annoying if you want to use a keyboard shortcut for the all caps character formatting option. You can use the “Keyboard Shortcuts” tab in System Preferences (under “Keyboard”) to assign a keyboard shortcut to “All Caps” in Pages, like, say, command-shift-A. But then you also have to assign another keyboard shortcut to “None” in order to be able to remove the character formatting option with the keyboard.

Since the all caps formatting option is reversible, I find it much more appropriate to have a keyboard shortcut that functions as a toggle key, so that I can use the same shortcut in both directions (to change from lowercase to all caps and to change from all caps to lower case).

This can be done, but not with “Keyboard Shortcuts” in System Preferences. Instead, you first have to create the following AppleScript script:

tell application "Pages"
	set mySel to (get selection of document 1)
	if capitalization type of mySel is all caps then
		set capitalization type of mySel to normal capitalization
	else
		set capitalization type of mySel to all caps
	end if
end tell

(I saved that script as “Toggle All Caps.scpt” on my machine.)

And then you need to use a third-party tool like FastScript or Keyboard Maestro to assign the desired shortcut to that script. I assigned command-shift-A to it and made sure that same shortcut was not used by anything else. (Check under “Services” in “Keyboard Shortcuts” if you have any conflicts.)

Et voilà! Now I can use command-shift-A as a shortcut to toggle between all caps and lowercase in Pages.

The same method can be used for the “Small Caps” formatting option in Pages. In AppleScript, the value to use is small caps.

For some reason, however, the third formatting option under “Capitalization,” which is “Title,” does not appear to have an AppleScript equivalent. At least it’s not listed in the AppleScript dictionary for Pages ’09. If it is not documented and actually exists in AppleScript and someone has managed to guess it, I would appreciate the tip. (I’ve tried both title and title case and they don’t work.)


Comments are closed.