If statement 如果包含单词,则使用Applescript
这是我的剧本:If statement 如果包含单词,则使用Applescript,if-statement,applescript,contain,If Statement,Applescript,Contain,这是我的剧本: 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”,那么脚本将失败(不会检测到任何东西)。我如何使脚本检测到这一点 亲切问候如果要检查集合
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”,那么脚本将失败(不会检测到任何东西)。我如何使脚本检测到这一点
亲切问候如果要检查集合中的项是否包含子字符串,则需要重复循环
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
谢谢,问题是如果找到的变量是“Minecraft:Story Mode”,而不是不起作用的变量,或者我应该写下每个可以修复它的变量