Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript To Close Most Tabs

I wrote this script in effort to have an applescript close all windows with more than one exception. For example, if I had 10 tabs open, I may want it to only leave three critical work tabs open.


This script works to close all but the link shown. I have not figured out how to get it to work on more than one tab.


Any suggestions would be appreciated.


tell application "Google Chrome"

set windowList to every tab of every window whose URL does not start 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


deletetabItr

end repeat

end repeat

end tell

Applescript-OTHER

Posted on Nov 2, 2012 10:26 AM

Reply
3 replies

Applescript To Close Most Tabs

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.