Created
June 26, 2011 20:56
-
-
Save rentzsch/1047967 to your computer and use it in GitHub Desktop.
Close a Chrome Tab using AppleScript
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
tell application "Google Chrome" | |
set windowList to every tab of every window whose URL starts with "https://mail.google.com" | |
repeat with tabList in windowList | |
set tabList to tabList as any | |
repeat with tabItr in tabList | |
set tabItr to tabItr as any | |
delete tabItr | |
end repeat | |
end repeat | |
end tell |
Thanks buddy just what I needed ; )
on run argv
tell application "Google Chrome"
set windowList to every tab of every window whose URL starts with item 1 of argv
repeat with tabList in windowList
set tabList to tabList as any
repeat with tabItr in tabList
set tabItr to tabItr as any
delete tabItr
end repeat
end repeat
end tell
end run
If you need to have the url passed as parameter !
I do like the idea, but too bad that it fails in Safari when you have 10 tabs open that contains your condition. Chrome works flawless!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm curious if there's a way to close extension windows too; like the Hangouts extension is opening windows that are in the Chrome app; even cmd+` will rotate through them. Not sure if I can tell if there's a URL associated though.