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.