我认为只需使用“或”运算符就可以检查变量“theMessage”是否包含“x”或“y”。显然不是。
我试过这个:
else if theMessage contains {"display", "screen"} then
--sleep computer's display
do shell script "pm displaysleepnow"
set theResponse to "Now sleeping the computer's display"
我将有可能写了很多的这些,所以这会是巨大的,如果我能得到一个子程序去为期限的条款与运营商...如
if theMessage contains {....} not {....}
你必须使用重复循环,像这样
on containsItems from qList against theText
repeat with anItem in qList
if theText contains anItem then return true
end repeat
return false
end containsItems
并使用它
set theMessage to "ashlfkjhalksjdhfscreenwperoivj"
set queryList to {"display", "screen"}
set doesContain to containsItems from queryList against theMessage
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句