MACRO: Select or Open a New Browser Tab, v6.0

I've updated the OP with Version 4.0 of Activate, Reload, or Open Browser Tab:

  • Added support for Arc.*

  • Added a third trigger Mode: x:URL, where x is a single character (case insensitive) used to specify the browser, i.e., the first letter of one of the supported browsers: Safari, Arc, Chrome, Brave, Edge, or Vivaldi

  • Added the settings local_Browser_default, local_ReplaceMatchedUrl_default, local_ReloadTab_default, and local_NewWindowIfNotFound_default.

This is soooooo good _jims! v4 Caller–Example 4 is great - tried a couple others without much reading the "manual" and could tell v4 Caller–Example 4 would work. Was able to just trial & error with the three booleans and now I have two amazing macros for two different repetitive Chrome tasks.

As with many things, it wasn't that it took so much time to command tab & control tab to where I wanted... but I knew there was a better way and it was painful I hadn't set up something like this.

Minutes later, I'm as happy as a clam, calling the shortcuts via this one steadily increasing Conflict Palette. (heh, doesn't sound much like a peacetime feature, but it's great - should prob move to Macro Group Palettes or something in the future)

Thank you for TIME and sanity @_jims !

Edit: said "v4" when I meant the fourth example macro

1 Like

I've updated the OP with Version 5.0 of Select or Open a New Browser Tab:

  • Changed the macro name from Activate, Reload, or Open Browser Tab to Select or Open a New Browser Tab.

  • Browser Additions:

    • Added full support for the Orion browser.
    • Added partial support for the Firefox browser. (Its AppleScript dictionary is extremely limited, so macro interaction with Firefox is a subset of other supported browsers.)
  • Input Format Enhancements:

    • Made Format 3 [YAML] the recommended structured input method due to its simpler syntax and improved readability.
    • Added support for both full‑line and inline comments.
  • Pattern Matching Enhancements:

    • Added webpage title–based matching via the new TitlePattern key, enabling regular‑expression matching against tab titles.
    • Added automatic inference of match logic based on which patterns are provided, with optional explicit override via the MatchLogic key:
      • none — ignore both URL and title patterns (inferred when neither UrlPattern nor TitlePattern is provided)
      • url-only — match URL pattern only (inferred when only UrlPattern is provided)
      • title-only — match title pattern only (inferred when only TitlePattern is provided)
      • or — match either URL or title pattern (inferred when both patterns are provided)
  • New/Enhanced Browser Action Keys:

    • NewWindowAlways: If 1, always open a new window, bypassing all tab matching. This is the highest-precedence override—when enabled, the browser will create a new window regardless of whether a matching tab exists.
    • NewTabAlways — If 1, always open a new tab in the frontmost window, bypassing all tab matching. This is the second-highest precedence override. If both NewWindowAlways and NewTabAlways are 1, NewWindowAlways takes precedence.
    • UrlPattern — This key also now supports a special option, -d (or --domain), which automatically sets UrlPattern to a case-insensitive representation of the Url domain: (?i)^https?://(www\.)?<domain>(?:/.*)?$ e.g., (?i)^https?://(www\.)?forum\.keyboardmaestro\.com(?:/.*)?$
    • TitlePattern — Regular expression pattern to match against tab titles. For example: .*Engine\.log.* to match any tab that includes "Engine.log" in the title. See Regular Expression Patterns for pattern syntax and examples.
    • MatchLogic — Determines how patterns are matched. Valid values: none, url-only, title-only, or
    • ReplaceMatched — (This key replaces ReplaceMatchedUrl.) If 1 and a pattern match is found, replace the matched tab's URL with Url. If 0, simply select the matched tab.
    • DryRun — If 1, process the invocation spec and echo the resolved browser action keys without actually opening any browser tabs. This is useful for debugging and inspecting how keys are resolved, inferred, and merged with preferences—see Key Inferences and Defaults. If 0, execute normally.
  • Settings / Preferences Architecture:

    • Consolidated preferences into a single YAML‑formatted variable: local_Preferences.
  • Usability Enhancements:

    • Smart quotes — Converts smart quotes to straight quotes in YAML and JSON.
    • Boolean values — Accepts 1/0, true/false, yes/no, t/f, and y/n in YAML and JSON.
    • Case-insensitive input — Treats key names and values as case-insensitive in both YAML and JSON.
    • Lenient JSON parsing — Handles imperfect JSON gracefully, including single backslashes in regular‑expression patterns.
  • Macro Design Improvement—Introduced a three‑stage processing architecture:

    • Stage 1 — Input processor: format detection, normalization, and inference
    • Stage 2 — Normalized YAML (from Stage 1) mapped to macro local variables
    • Stage 3 — Browser‑specific AppleScript execution
  • Backward Compatibility : Macros that called Version 4.0 of this macro will continue to function; however:

    • Key ReplaceMatchedUrl is no longer recognized; ReplaceMatched should now be used.
    • Format 4 [JSON] is deprecated yet remains fully supported—aside from the removal of ReplaceMatchedUrl—while Format 3 [YAML] is now preferred for its simpler syntax and improved readability.
  • Documentation & Testing:

    • Expanded documentation significantly, including new Quick Start and Implementation Overview sections.
    • Added the DryRun key for testing configurations before browser interaction.
1 Like

Thanks for making this @_jims - I use it constantly!

Is it(/will it be) possible to use it with Zen browser at all? Seems like a fair few former Arc users (including me) are switching to it now Arc's been more or less abandoned. I think it's based on Firefox, however easy/difficult that might make it to implement?

Thanks again :slight_smile:

Hi, @lbdm.

I just downloaded the Zen Browser and unfortunately it appears that it has very sparse AppleScript support (like Firefox). Also, I did a quick check and it looks like there is no Shortcuts support.


Yes, The Browser Company has shifted gears to Dia and is no longer investing heavily in Arc, but it seems that they are providing limited updates. In fact, I just downloaded one today.

Hi @_jims, thanks for replying. That’s a shame, but makes sense given its Firefox base.

Unfortunately Dia isn’t an option for me, so will just have to keep looking - or return to Safari…

I've updated the OP with Version 6.0 of Select or Open a New Browser Tab.

UrlPattern and Url now correctly support file:// URLs (e.g., file:///Users/name/Downloads/example.html) for local HTML files opened in a browser tab.