Applescript to quit all active browser processes

applescript

I am trying to quit all the active browsers using the below code, but am unable to get the list of all active browsers to quit.

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

Best Answer

tell application "System Events"
    set ProcessList to name of every process
    if "Safari" is in ProcessList then
        tell application "Safari"
            quit
        end tell
    end if
end tell

Repeat as needed