Created
December 31, 2016 18:47
-
-
Save HR/9d92eb2cdfa36c4af833a4586f5bd986 to your computer and use it in GitHub Desktop.
Close tabs containing a URL in Safari Applescript
This file contains hidden or 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
on run argv | |
set passedInURL to (item 1 of argv) | |
tell application "Safari" | |
set windowCount to number of windows | |
repeat with x from 1 to windowCount | |
set tabCount to number of tabs in window x | |
repeat with y from 1 to tabCount | |
set thistab to tab y of window x | |
set thisURL to URL of thistab | |
if passedInURL is in thisURL then close thistab | |
end repeat | |
end repeat | |
end tell | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment