How to close specific URLs with Applescript I'm trying to write a little applescript that closes tabs that have URLs that do not contain certain text, but I can't get it to work.

Right now, my script closes every tab regardless of the URL. When it should only close specific URLs.

Can anyone tell me where I've gone wrong?

Here's the script…

tell windows of application "Google Chrome" to close (tabs whose URL does not contain {"business.facebook", "pinterest"} as text)
This works:

tell windows of application "Google Chrome"
    close (tabs whose URL does not contain "business.facebook" and URL does not contain "pinterest")
end tell


In an AppleScript whose clause you need to spell out each criteria fully and join them with a logical operator. You tried to use a list to make an implicit and; that makes sense to the human brain, but AppleScript can't parse it.