Change Default Browser Macro (v9.0.5)

MACRO:   Change Default Browser

UPDATED: 2020-06-26 15:43 GMT-5

  • Ver 2 adds option to be called as a Sub-Macro. See ReleaseNotes for details.

-~~~ VER: 2.0    2020-06-26 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Change Default Browser.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


Credits

  • This macro is based in large part on a related macro by @Tom.
  • It uses an AppleScript written by Chris Stone @ccstone
  • It uses an AppleScript written by Shane Stanley (integrating Swift with AppleScript)
  • The main difference of this macro is the following:
    • May be Triggered Directly or as a Sub-Macro (see below for details)
    • Provides a Prompt for the user to select the new default Browser
    • Provides an option in the Prompt to provide a list of the Bundle ID of all Browsers installed on the user's Mac.
    • Checks to ensure Xcode.app is installed, and if not notifies user.

Example Output

Change This Action To Be Your Selection List
(Must use format of BundleID__DisplayName)

Option on Prompt To Display All Browsers on Your Mac

When Calling as a Sub-Macro

image

If the Bundle ID is Invalid


ReleaseNotes

Author.@JMichaelTX Based on Macro by @Tom

PURPOSE:

  • Change the Default Web Browser
    • The new default ay be provided by Prompt User with Selection List, OR by Execute Macro Parameter.

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. Macro may be Triggered in two Different ways:
    1. Direct Trigger using HotKey or other
      • User selects a Browser from the popup menu.
    2. Called as a Sub-Macro
      • Browser Bundle ID must be provided as a Parameter to the Execute Macro Action
      • If Bundle ID is not valid, a list of valid IDs will be displayed.
  3. IF Xcode.app is NOT installed, Window will be displayed and macro cancelled.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro, and the Macro Group it is in.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    • CHANGE If Needed to Show List of Browsers on Your Mac
      • Must use format of BundleID__DisplayName

REQUIRES:

  1. KM 9.0+ (may work in KM 8.2+ in some cases)
  2. macOS 10.11.6 (El Capitan)+
  3. Must have Xcode.app installed (required for use of Swift script)

TAGS: @Browser @Default @Script @Swift

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

1 Like

Just updated above post/macro.

Hi @JMichaelTX, thanks for this. Looks complex but powerful.
Have it installed and it works.

Now, I see a Big Sur "message box" popping up, I recorded it, and it shows the question wether I want to change my Default Browser...

CleanShot 2020-12-06 at 18.51.42@2x

Any idea on how to avoid this?