Hello all, I'd reached a point of exasperation with myself over the frustration of attempting to do something simple and getting sidetracked by the distraction created by a previously open tab.
Wondering if there could be a script to automatically close safari tabs after a set duration of time passes. Maybe a script that simply runs the close all tabs after a set period of time elapses after not using safari. it could be worth it for productivities sake to simply have tabs auto-close themselves.
I'm new to Keyboard Maestro, did do some searching on this forum and didn't come up with much.
Thanks in advance!
welcome to the forum.
So, you have multiple tabs open in Safari then we need to clarify some things about what you want:
you switch to a new tab and after a fixed amount of time you want the "close other tabs" menu choice to be triggered. (there is no "close all tabs") as far as I know.
you switch to another application. Safari is still running in the background and after a fixed amount of time you want to "close all windows" or quit safari (?)
in case you want to close tabs and not windows do you have cases when you have multiple windows with multiple tabs ?
Here is an untested workflow to do this:
- Create a Macro that is triggered when Safari deactivates:
- Set a KM Global Variable to the current
- Enable the Macro created in Step 2
- Create another Macro using a Periodic trigger.
- While you can set this to a number of seconds, I would not use less than 1 minute
- Compare the current
TIME() with the KM Global variable in Step 1
- Disable this Macro
There are probably other Actions you will want to include, but this should give you a rough idea of how to design a Macro to achieve your objectives.
The second scenario you paint is more what I’m looking for.
I’m simply tired of being distracted by previously left open tabs. Yes I could discipline myself to close them but thought an automation might be a useful help.
Thanks for the reply!
Thank you JMIchaelTX!
I'll give it a go. Much appreciated!