shutting down the mac with speech recognition server and applescript

Hi,

I’m trying to make my macbook shut down via voice command, however I’m not getting past the first prompt. I saved this script as “shut down” in the speakable items folder, and when I say “Shut Down” it responds, like it should, with “Are you sure you want to shut down?” However, it stops here. If I say yes or no it does nothing at all. Can anyone help with this? The script is below: :slight_smile:



tell application "SpeechRecognitionServer"
	set theResponse to listen for {"shut down"} with prompt "Are you sure you want to shut down now?"
	set theResponse to listen for {"yes", "no"}
	if theResponse is "yes" then
		say "ok Rocco. If that's what you want...now shutting down." with waiting until completion
		tell application "Finder"
			shut down
		end tell
	end if
	if theResponse is "no" then
		say "Sorry, I missunderstood you then. My fault."
	end if
end tell

Thanks so much,
Rocco