Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Created November 6, 2020 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttscoff/736942c65bae0a28218d834aca0c14d5 to your computer and use it in GitHub Desktop.
Save ttscoff/736942c65bae0a28218d834aca0c14d5 to your computer and use it in GitHub Desktop.
Close all those xxx.zoom.us tabs that got left open in Safari
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set tabsToClose to {}
tell application "Safari"
-- cycle through all open windows
repeat with _window in windows
-- cycle through all tabs of given window
repeat with _tab in tabs of _window
-- if the URL is a zoom.us URL, add it to the list to close
if URL of _tab contains "zoom.us" then
-- we want the tabs in reverse order
-- otherwise closing one throws the index off
set beginning of tabsToClose to _tab
end if
end repeat
-- close matching tabs in current window
repeat with _tab in tabsToClose
close _tab
end repeat
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment