我正在创建一个小程序,我的一个功能是一本字典。我需要一种方式来分割主题,但由于某种原因,我的代码无法工作。我不断收到错误“Expected”else“等,但发现”end tell“。”此代码:修复脚本编辑脚本为苹果脚本
set math_list to {"math", "Math"}
set science_list to {"science", "Science"}
set history_list to {"History", "history", "Social Studies", "social studies", "socialstudies"}
set reading_list to {"writing", "reading", "grammar", "Grammar", "Reading"}
set no_list to {"no", "not really", "I am ok", "I am good", "I am good"}
set complete_list to reading_list & math_list & science_list & no_list & history_list
tell application "SpeechRecognitionServer"
set theResponse to listen for complete_list with prompt "Would you like to search under the subject math, science, history, or reading"
if theResponse = "writing" then
set theResponse to "reading" --Otherwise you would get a very weird sentence
else if theResponse = "grammar" then
set theResponse to "reading" --Otherwise you would get a very weird sentence
if (math_list contains theResponse) then
say "Opening Google Chrome"
launch application "Google Chrome"
else if (science_list contains theResponse) then
say "Opening Google Chrome"
launch application "Google Chrome"
else if (history_list contains theResponse) then
say "Opening Google Chrome"
launch application "Google Chrome"
else if (reading_list contains theResponse) then
say "Opening Google Chrome"
launch application "Google Chrome"
else if (no_list contains theResponse) then
say "Ok then"
end tell
end tell
谢谢,这有助于很多! –