这是我的剧本:
set APPS to { "facebook", "Minecraft"}
if appName contains APPS then
display notification "app founds" with title "Apps"
我也尝试用
if appName is in APPS then
但是在这个例子中,如果找到的应用程序是“Minecraft:Story Mode”,那么脚本将失败(不会检测到任何内容)如何让脚本检测到这个?
亲切的问候
答案 0 :(得分:2)
如果您想检查集合中项是否包含子字符串,则需要重复循环
set APPS to {"facebook", "Minecraft"}
repeat with anApp in APPS
if appName is in anApp then -- or anApp is in appName depending on which is the substring
display notification "app founds" with title anApp
exit repeat
end if
end repeat