【发布时间】:2018-06-29 23:16:08
【问题描述】:
看下面的代码:
set TheStringsQ1Happy to {"Fabulous", "Great", "Alright", "Excited", "Not Bad", "", "Decent", "Fine", "Awesome", "Bored", "Cool", "Sad", "Fantastic", "Alright", "Good", "Ok"}
set theResponse to the text returned of (display dialog "" default answer "" giving up after 5)
if TheStringsQ1Happy contains theResponse then
display dialog "That's Great!"
else
say "That term is not in my vocabulary. Would you like me to add it?" using "Tom" speaking rate 220
set theResponseNotInVocabulary to text returned of (display dialog "" default answer "" giving up after 5)
if theResponseNotInVocabulary is "Yes" then
set end of TheStringsQ1Happy to theResponse
return TheStringsQ1Happy
end if
虽然我可以更新TheStringsQ1Happy,但此更新仅持续脚本的跨度。如何更改代码,以便每次运行脚本时,它也包含更新的词汇表?
例如,如果我说“All Good”,计算机会识别出词汇表不在列表中,并且稍后会仅针对该实例更新此列表。我怎样才能让它从现在开始在每个实例中都保持“All Good”?
【问题讨论】:
标签: macos scripting applescript automator