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



我试图使用以下代码退出所有活动浏览器,但我无法获得所有活动浏览器的列表退出,我尝试了以下代码...请建议..

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

您不能退出"进程",只能退出"应用程序"。此外,您必须完成所有可能的浏览器名称的浏览器列表。

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

最新更新