Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Speech Recognition Server Fix?

Hi, I was writing a few AppleScripts with speech commands (in Snow Leopard) but I ran into errors with my Speech Recognition Server application. I know that this is a pretty old subject but were there ever any workarounds released to solve the issue?

MacBook, Mac OS X (10.6.8)

Posted on Apr 30, 2012 9:52 PM

Reply
6 replies

May 1, 2012 11:03 AM in response to Camelot

Running an AppleScript like the one below will not work correctly on my computer. I have speech recognition turned on but it will either give me the prompt and then hang until the script times out or just hang until the script times out without asking me for the prompt at all.

tell application "SpeechRecognitionServer"

set theResponse to listen for {"yes", "no"} with prompt "Hello. Do you like me?"

if theResponse is "yes" then

say "I like you, too."

else

say "I don't care whether you like me or not."

end if

end tell


I was looking around and it seemed that other people had similar problems (macscripter discussion, previous apple support question). Do you have any advice?

May 1, 2012 1:31 PM in response to greenyouse

two things:


first, try not to put osax-based commands inside of application tells. 'say' is a command in the standard additions osax, and is not guranteed to work when called in any context other than the main script context. rewrite like so:


tell application "SpeechRecognitionServer"

set theResponse to listen for {"yes", "no"} with prompt "Hello. Do you like me?"

end tell


if theResponse is "yes" then

say "I like you, too."

else

say "I don't care whether you like me or not."

end if


second, and more to the point, you need to hold down the escape key (by default) to get the speech recognition server to listen. you'll know it's listening because the microphone will go from gray to black and moving arrows will appear pointing in at the mic.

May 2, 2012 8:48 AM in response to twtwtw

Ok, I didn't know about moving the 'say' commands outside of the tell block, I'll do that. The speech recognition was already set up on my computer and it works well on everything except AppleScript Editor.


I tried running your version of the script and it works on the first run, but then it gets stuck and never says the prompt or listens to anything on any of the runs after that. Do you have any ideas for what could be causing it / how to fix it?

May 2, 2012 9:24 AM in response to greenyouse

On my machine it works on alternate runs, and I set a 'getComponentVersion failed' error in console. Apparently the speech recognition server is hanging after processing a command. probably needs a bug report to apple. you can solve the problem hackishly by adding the following line at the end of the script:


do shell script "killall SpeechRecognitionServer"


this kills the server immediately, letting the script run next invocation.

Speech Recognition Server Fix?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.