Applescript 如果包含一个词
Applescript if contains a word
这是我的脚本:
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
这是我的脚本:
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