Chapter 30. Speech Listener and SpeakableItems Extension

Mac OS 9 offers three different ways to use AppleScript to control how the computer responds to verbal commands and “speaks” back to the computer user. Using combinations of these methods, you can create complex and useful speech-related scripts:

  • The listen for AppleScript command, which controls the computer’s response to spoken commands. The options that control how the computer listens for commands, such as the key on your keyboard that will toggle this technology on and off, can be controlled with the Speech control panel (see Figure 30-1).

The Speech control panel
Figure 30-1. The Speech control panel
  • The SpeakableItems technology allows the user to execute a script inside the SpeakableItems folder (which is located in the startup disk:System Folder:Apple Menu Items folder) just by speaking the script’s filename into the computer’s microphone.

  • The say command, a scripting addition that has been part of the Standard Additions osax since Mac OS 8.5 (See Appendix A). As long as the Speech Manager extension is enabled, the computer will speak any text or string that you specify in an AppleScript with say, as in:

say "It's nice to hear text rather than read it sometimes."

Figure 30-2 shows the three extensions that have to be installed with Mac OS 9 to use the three speech-related technologies with AppleScript.

Figure 30-2. Speech extension files

Get AppleScript in a Nutshell 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.