|Tip 136||Create Doc Templates and Boilerplate Text|
Let’s say you’ve created a form letter that you periodically send out to different people, changing only the name and address details. Some word processors allow you to create document templates. These are master files that, when opened, will create a new file containing the document’s contents. But did you know that this feature is built into your Mac, and you can use it with any kind of file in practically any application?
It’s also possible to automatically insert boilerplate (that is, stock phrase) text into a document or new email using OS X’s Text Substitution feature.
Creating and Using a Template
To create a template, simply create a new file and then save it as usual, or locate an existing file. In either case, you must close the file, locate it using Finder, and select it before hitting Command+I to bring up the File Info dialog box. Then put a check in Stationery Pad, under the General heading near the top of the dialog box.
From now on, whenever anybody double-clicks to open the file, a copy of the file will automatically be created and opened for editing (usually with the filename of the original plus the word copy appended).
To open the original for editing at any stage, click and drag it straight to an application’s Dock icon or open it using the File→Open menu option within an application.
To return the file to being an ordinary nontemplate file, just repeat the previous steps, but remove the check from the Stationery Pad box.
Creating and Using Text Substitution Phrases
OS X includes the ability to autocorrect mistypes. For example, type “teh,” and it will correct it to “the.” This feature is known as text substitution, and it can be subverted so you can insert just about any word, sentence, or paragraph—even a series of paragraphs—when you type a particular keyword. Here’s how to set it up:
Open System Preferences (Apple menu→System Preferences), and then click the Language & Text icon.
Click the Text tab, and then in the list of substitutions on the left, click the plus button at the bottom.
In the Replace field, type the keyword you want to trigger the substitution. For example, if you wanted to insert a boilerplate paragraph of legalese, you could type legalbp. It’s important to choose a keyword that you’re not going to type in everyday use.
Hit Tab to move to the With field. Here’s where you should type (or paste in) the word, sentence, or paragraph(s) you want to appear when the keyword is typed (hit Option+Return for a line break and Option+Tab to indent the text). Don’t worry if the text you type doesn’t appear to fit in the small field—it will all be recorded. Hit Return when done.
Repeat the previous steps however many times are needed to store all the boilerplate phrases you want.
In any application where you want to use the substitutions, you must select the Text Replacement option on the Edit→Substitutions menu so that it has a check next to it. You need to do this only once. (Remove the check next to the entry to deactivate substitution for that app.)
Note that any substitution won’t appear until you hit Space after typing the keyword.
To delete a substitution, again open System Preferences, and navigate to the Text tab of the Language & Text pane. Select the entry in the list, and click the minus button. To temporarily deactivate a substitution, simply remove the check next to it.