我正在創建一個小程序,我的一個功能是一本字典。我需要一種方式來分割主題,但由於某種原因,我的代碼無法工作。我不斷收到錯誤「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
謝謝,這有助於很多! –