Getting scripts to speak

    The Standard Additions dictionary includes the Say command. To see the syntax of the command, open the Standard Additions dictionary in the Script Editor, locate the User Interaction suite, and click "say."

    Open the Standard Additions dictionary for me.

    You can use the Say command to make your scripts speak. You can use this feature to report the outcome of actions, to read aloud the contents of fields from databases, or to report other information.

    For example, the following script uses the Say command to speak the number of items found:

    set numberFound to 5
    say (numberFound as text) & " items were found."

    If your scripts do not speak:
    The text-to-speech technology may not be installed on your computer. To add this software, use the Mac OS Installer, located on your Mac OS CD or the software install CD that came with your computer.

Making the computer's speech sound better

    You can make the computer's speech sound more natural using punctuation to add pauses and terms to remove unnecessary emphasis.

    Adding pauses:
    To add a pause to a spoken line:
    Insert a comma where you want a pause to occur.
    For example:
    say "You have a meeting, next Monday at 3:30, in room 57."

    To add a shorter pause before and after a phrase:
    Put single quotation marks around the phrase.
    For example:
    say "The file 'status report' has been printed."

    Adding emphasis:
    To add emphasis to a word:
    Insert [[emph +]] before the word.
    For example:
    say "I [[emph +]] love my Mac."

    Removing unneeded emphasis:
    To remove emphasis from a word:
    Insert [[emph -]] before the word.
    For example:
    say "Five [[emph -]] documents were printed, and three were [[emph -]] copied to backup."

    Emphasis is automatically removed from common short words such as "to," "and," "were," and "the."

    Changing voices:
    To change the voice:
    Include the word "using" followed by the name of a voice.
    For example:
    say "I love my Mac!" using "Victoria"

    Changing voice rates:
    To change the rate of speed:
    Insert [[rate speed]] before the phrase.
    For example:
    say "[[rate 180]] I love my Mac."
    The speed can be between 160 and 210.

Related topic

 


Table of contents