How to turn on Speech Recognition with a script?

The floating round window associated with Speech Recognition is sometimes annoying and I want to turn it off for few minutes then turn it back on.

I can easily turn off Speech Recognition by using this script:

tell application “SpeakableItems”
quit
end tell

But what about turn it back on? I know it is possible to script “System Preferences” but it would be a rather long script that opens the System Prefs, switchs to Speech, then goes to the Speech Recognition tab and finally toggles the On/Off. It takes as long as doing it manually.

Sorry, I just got it. Here is the script to do it:

tell application “Finder”
open file “Macintosh HD:System:Library:Speech:Recognizers:AppleSpeakableItems.SpeechRecognizer:Contents:Resources:SpeakableItems”
end tell
(You might have to change the name of the drive that contains the system in the path.)

First, to open it by path and get the path dynamically on any system, try this:

But since it’s just an application, you can just tell the application “SpeakableItems” to launch or quit. Here’s a script that will toggle it off and on depending on whether it’s running or not:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thanks Jon

I did find a way before you answered but your script is MUCH more elegant and versatile.

Here is Jon’s script again. I had trouble opening the link above.


tell application "System Events" to set p to name of processes
if p contains "SpeakableItems" then
	tell application "SpeakableItems" to quit
else
	tell application "SpeakableItems" to launch
end if