AppleScript不了解“ApplicationIsRunning”消息

时间:2014-02-21 22:50:52

标签: applescript

我是AppleScript的新手,并尝试合并一个与我的VPN注销相关的脚本。基本上,如果我的VPN出现故障或我退出,我希望它出于安全目的关闭浏览器。但是,Applescript不会“理解”我在网上随处可见的ApplicationIsRunning支票......有什么想法吗?

set apps to {"Firefox", "uTorrent"}
repeat with thisApp in apps
    if ApplicationIsRunning(thisApp) then
        tell application thisApp to quit
    end if
end repeat

错误:

error "«script» doesn’t understand the “ApplicationIsRunning” message." number -1708 from «script»

1 个答案:

答案 0 :(得分:1)

尝试:

set apps to {"Firefox", "uTorrent"}
repeat with thisApp in apps
  if application thisApp is running then
    tell application thisApp to quit
  end if
end repeat