Created
November 6, 2020 15:38
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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