• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: applescript SAY command help needed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescript SAY command help needed


  • Subject: Re: applescript SAY command help needed
  • From: Chris Page <email@hidden>
  • Date: Wed, 08 Aug 2012 05:02:00 -0700

On Jul 28, 2012, at 1:01 PM, Dave <email@hidden> wrote:

Currently I don't have a way to stop this speaking in the middle - CMD period does not help.

You can interrupt the "say" command with Command-Period when the script is running in the foreground (on the main thread).

By default, when you run scripts inside Script Editor they're run in the background so you can continue to interact with Script Editor while scripts are running—and you can run multiple scripts simultaneously. To force Script Editor to run scripts in the foreground, press the Control modifier key so the Script > Run command becomes Run in Foreground.

Note that Script Editor is primarily intended as a development environment rather than the normal way to run scripts once they're written and tested. You should typically either save scripts as applications or invoke them from the system Script menu (or similar mechanisms). When run that way, they are run in the foreground and Command-Period will interrupt scripts on a more fine-grained basis.

Also note that even if you interrupt the "say" command, the speech itself continues, since speech synthesis is performed in another process while the "say" command waits for it to complete. Interrupting "say" just stops it waiting for the speech to finish. If you want to explicitly stop the speech in response to Command-Period, catch the "user canceled" error (-128) produced by Command-Period and then tell "say" to stop any current speech:

try
say "A long speech message that you can stop midway through."
on error number -128
say "" with stopping current speech
end try

-- 
Chris Page

 The other, other AppleScript Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: applescript SAY command help needed
      • From: dealTek <email@hidden>
  • Prev by Date: Re: When is a window not a window?
  • Next by Date: Re: OS X 10.8 Security & Applescripts - "unidentified developer"
  • Previous by thread: Re: applescript SAY command help needed
  • Next by thread: Re: applescript SAY command help needed
  • Index(es):
    • Date
    • Thread