Close Browser Default Startup Tabs Macro (v10.2)

Howdy folks,

Whenever I launch or activate a browser, oftentimes it will open a “Start”, “Favorites, “New Tab” etc. page. Sometimes these pages get left open, sometimes nestled behind other tabs I subsequently open. I don’t like having a lot of tabs/windows open, especially when they are these “startup” pages. So I wrote a macro sometime back that is designed to close these pages automatically. While I’ve actually been using it for quite some time, I decided to rewrite it for public use and share it in case anybody else finds it useful.

More details and screenshots are below. As usual, feel free to share any comments or suggestions, or to let me know if it doesn’t work for you.

-Chris

Download Macro(s): 44)[MG-SUBRT] Close browser default startup tabs.kmmacros (15 KB)

Macro-Image

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.5
  • Keyboard Maestro v10.2

CURRENT VERSION: 1.0.2 (Monday, August 14, 2023)

Version History

v1.0.2 Monday, August 14, 2023
Determines if browser is running first to prevent it from receiving a tell command and launching.

v1.0.1 Sunday, August 11, 2023
Added idle condition so newly opened pages wouldn’t close immediately.

v1.0.0 Saturday, August 12, 2023
Initial macro

RELEASE NOTES, INSTRUCTIONS AND DISCLAIMER

Purpose of this macro (click to expand/collapse)

Close browser “startup” pages automatically

How this macro works (click to expand/collapse)

When a browser launches, it waits until the front page is not "New Tab|Favorites|Start Page".
Then it closes any tabs that contain one of those strings.

How to use this macro (click to expand/collapse)

You can simply import this and leave it alone, or alternatively run it as an “execute a macro” action in any macros that open browser pages/tabs.

How to configure this macro (click to expand/collapse)

No configuration necessary for Safari, Google Chrome and Microsoft Edge.
If you use Firefox, Opera etc., you will need to add those to the triggers and AppleScript.

Disclaimer (click to expand/collapse)

TL;DR: I built it and it works for me. You can share/modify it how you want. But don't blame me if it doesn’t work for you :laughing:

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

5 Likes

UPDATE: I uploaded a newer version (1.0.1), because in the original I forgot to add an idle condition to prevent startup tabs from immediately closing in certain scenarios. :man_facepalming:t2:

See post 1 for more the most recent version.

Aannnddd.... we’re back. With version 1.0.2, whose AppleScript now checks to see if the browser is running before sending it tell commands. This prevents the browser from launching if it’s not already running.

See post 1 for more the most recent version.