Assistance Requested - How to write macro for Safari + 3rd party extension SwitchBrowser

I'm new to Keyboard Maestro...

I have created several macros with the Record function, but they are basic.

I have a handy 3rd party extension installed for Safari: SwitchBrowser.

Manually, with the mouse, in Safari select menu File > Share > SwitchBrowser, and whatever web page is open in Safari then opens in Chrome.

I am trying to automate this with KM (without using the Record function). Any idea of what commands I use within KM to activate those options in Safari?


Screenshot 2022-11-22 at 10.11.37 AM

What you want to do when the macro runs is:

  1. Get the URL of the current tab/window of Safari
  2. Open that URL in Chrome

"Getting" things is usually done with Tokens or (for numbery stuff) Functions -- have a look at the Token list for something that would help with step 1.

"Doing" things is usually done with Actions -- have a look at the Actions list to see what would do step 2.

It's then a case of putting the steps together -- a big hint on how to do that is that you can put tokens into text fields to use the token value rather than typing something in yourself. See the Tokens part of the manual for more.

Have a go yourself, but shout out if you get lost.

The above will get you the same result as your "emulate what I do in the UI" approach, but more efficiently. It's good to start with what you do manually, but you should think of the "what" rather than the "how" so you can make better, more robust, macros.

1 Like

Hey @possomcohen,

You're trying to automate the share sheet to select Switch Browser?

Or you want to replace this functionality with a Keyboard Maestro macro? If so then @Nige_S has given you a start.


Thank you very much. I'll explore this week-end.

Thank you very much.

Hello Nige + Chris,

Greetings from New Zealand.

Thanks for the links. I have been experimenting, trying to get it to work.

  • I got as far as activating Safari, File, Share...
    • Then the options menu presents itself and I have to manually click on Switch Browser.
    • Then the app successfully opens the url in Chrome.

Have not been able to figure out how to enter that Switch Browser option into the macro.

Any input will be appreciated.

Switch Browser - Safari to Chrome copy.kmmacros (4.1 KB)


  • What version of macOS are you using?
  • What version of Keyboard Maestro are you using?

It's good to provide this info when asking for help, because it can sometimes make a significant difference in getting a problem solved. The following macro makes this simple:

Paste Keyboard Maestro Version and macOS System Version

  • What browser are you trying to switch to?

It looks like you're using macOS Monterey or Ventura. (I'm still using Mojave, so I'm unable to test here.)

Apple decided to get cute with the share sheet and make it look like iOS, so KM's Select menu action doesn't work properly with it anymore.

Does the keyboard work with it?

I.e. can you type-select to get to items in the share sheet?

If so then type-select is your friend. If not then perhaps Click at Found Image

The simplest way of doing this is going to be to use the FrontBrowserURL token to acquire the URL of the frontmost browser (Safari or Google Chrome) and then send that off to the browser you want to open it in.

There is zero need to automate the share menu or Switch Browser for this use case. Like @ccstone said above, you can open Safari's current URL token in Chrome with a single KM action:

Open in Chrome.kmmacros (2.3 KB)

I use Brave Browser instead of Chrome, but you can change the Open URL's setting to Chrome easily enough.


Hello @ccstone + gglick:

Works like a charm. Thank you very much.

Download: Open in Chrome.kmmacros (2.3 KB)