Install an AppleScript
Updated for Word 2008
If someone on a newsgroup or listserv gave you an assortment of words to fix a problem, and the words start with “tell” and mostly look like English, that’s probably an AppleScript. Here is how you put the AppleScript into a form you know how to use.
1. Launch Script Editor. Script Editor is located inside the AppleScript folder in the Applications folder. It is included in all versions of the Mac OS.
2. Copy the script into a new window in Script Editor. Click Compile on the Script Editor toolbar—the script will reformat itself if there are no errors. If the script has errors, it will give you an error message and highlight the incorrect spot. The most likely reason for an error showing up would be a line break in the wrong place, caused by copying and pasting from email, which often forces shorter lines. Re-examine the script and see if you can figure out where the line breaks should be.
3. Click Run in Script Editor. The script will run, and should do whatever it is supposed to do. You might consider testing scripts you get from other people on a COPY of your document, just to prevent worst-case scenarios.
Word 2008
4. Save the script in ~/Documents/Microsoft User Data/Word Script Menu Items. You may need to create this folder if it does not already exist. Access the script anytime from the Word script menu. (~ is short for your username or home folder in OS X, so availability will be specific to that user account.)
5. To assign a keyboard shortcut to the script, you add a special code to the name of the script when saving it. For full details, visit the Entourage Help Page. You can also use the OS X System Keyboard Shortcuts—look in Mac Help or see Apple's online instructions for 10.5 (Leopard) [NOTE: outdated link removed by Lene Fredborg 19-Feb-2017] and 10.4 (Tiger) [Lene Fredborg, 4-Feb-2019: Removed outdated link to http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh1619.html].
Word 2004 or earlier
4. If there is no Script Menu on the right side of your OS X menubar, go back to Applications/AppleScript/ and double-click Install Script Menu. You should see an icon like this in the menu bar:
5. Save the script in ~/Library/Scripts/, setting the Format to "script" in the Save dialog. Let the OS add the ".scpt" extension if it so chooses. All scripts saved in ~/Library/Scripts/ are available from the main script menu in OS X. (~ is short for your username or home folder in OS X, so availability will be specific to that user account.)
6. Simply select the script from the main script menu whenever you want to run it.
Prevent Clutter in the Main Script Menu
As you accumulate AppleScripts for use in MS Word and other programs without their own script menu, the main script menu can get a little crowded.
- You can select Hide Library Scripts in the main script menu, to prevent the built-in scripts from cluttering your script menu.
- You can easily categorize your scripts by creating subfolders in ~/Library/Scripts/ that will be reflected in the menu.
- If many of these scripts will only be run from inside a particular application, you can set up a folder structure that hides them unless you are in that application. Create a folder "Applications" in ~/Library/Scripts/. Create subfolders of Applications that have the exact same name as the application. For instance, scripts in a subfolder ~/Library/Scripts/Applications/Microsoft Word/ will only appear when the active window is an MS Word document. Keep in mind that there may be Word-specific tasks—say, launch a document—that you will want to do from outside Word.