Do variable vs field as AppleScript

David V Glasgow dvglasgow at
Wed Jul 3 06:28:44 EDT 2019

I have a script which in the fullness of time will repeatedly (several hundred times) run a list of commands as an Applescript.  It will take a fair bit of time to loop through because each iteration involves speech recognition.

My question is, will there be any meaningful speed advantage to storing the AppleScript in a variable rather than field?  This doesn’t mean finishing all 340 iterations faster, because the slowdown is the human thinking about the question and giving a response.  I’m thinking about a bit more responsivity from 

tell application "SpeechRecognitionServer"
	local tresult, choicesLanguageModel, titem
	set choicesLanguageModel to {"false", "slightly true", "mainly true", "very true"}
set tPrompt to "item 6"
	set tresult to listen for choicesLanguageModel with prompt tPrompt giving up after 30
	say tresult
	return tresult
end tell

(I should say that the line "set tPrompt to "item 6”” looks a bit weird because it is incremented under script control, and when that happens the indent is lost.)

I know I could test, but if someone just knows….


David Glasgow

More information about the use-livecode mailing list