Close tabs in Safari

Is there a way using KME to make a macro for Safari OS X that will close a tab every time a new tab is open after a set number of tabs are open?

Thanks for any help or links to examples to get me started.

Im using KME 8.2.4 and OS X 10.14.2

Hey John,

You need to be more specific.

A tab in the front window?

A tab in a background window?

There's no way to determine the age of tabs, but you can definitely close them.


Yes a tab in the front window. Close any tab except the active one or the first one in the tab bar.
Thank you.
Safari V 12.0.2
I have looked for a extension to handle tabs but don't see one.

Hey John,

You can do something like this:

Close Oldest Tab.kmmacros (4.7 KB)

But that's not going to cover cases where you create a new tab in the background.

Keyboard Maestro cannot detect you clicking links, it can only detect events that are reported by the macOS.


Thank You very much!

1 Like