Applescript退出Mac上的所有活动浏览器?

时间:2012-12-03 08:41:13

标签: applescript

我正在尝试使用以下代码退出所有活动浏览器,但无法获取所有活动浏览器的列表以退出,我尝试下面的代码...请提示..

tell application "System Events"

    set appList to every process whose visible is true

    repeat with thisApp in appList
        tell process browser
            quit
        end tell
    end repeat
end tell

1 个答案:

答案 0 :(得分:0)

你不能退出“进程”,只能退出“应用程序”。此外,您必须为所有可能的浏览器名称完成browserList。

set browserList to {"Safari", "Firefox"}

tell application "System Events"
    set appList to name of every process whose visible is true
end tell

repeat with i from 1 to count of appList
    set thisApp to item i of appList
    if thisApp is in browserList then
        tell application thisApp to quit
    end if
end repeat