I'm no good at writing macros that affect Keyboard Maestro itself, so before I embark on replacing hundreds of actions by hand, I thought I'd ask:
Does anyone have a macro to replace Chrome-centric actions with actions that work with other (not Safari) browsers?
Now that Google has come out of the closet as overtly evil, I'm trying to reduce my reliance on Google (Search, Chrome, etc.) and trying out Chromium-based browsers with privacy and security, like Brave, Vivaldi, and so on. I'd like to be able to use my many macros that open browser windows and tabs as part of the testing, even if I have to go back to Chrome.
I'm not sure I fully understand the question, and I haven't used Chrome in a very long time, but many of those could be replaced by just executing the right actions in your browser of choice. That is, send the "New Tab" menu command to the browser. Or the "New Window" command, etc.
But there are a lot of Chrome actions in Keyboard Maestro; which ones are you using?
Also, the Open URL action can specify any application (that's capable of handling URLs) you want to choose.
My point is that I already have a lot (a lot) of Chrome-centric actions within macros, and I'm hoping for a way to replace them with equivalent actions without manually doing them all.
Oh, I missed that you were trying to automate this; sorry! I think there have been some posts on similar subjects here over the years, but I couldn't find any in a quick search. I think it'd be very complicated, though, because you'd have to search the XML file of your macros for strings of text, and then replace with new XML for the replacement actions.
But anything approaching that scope of work is well beyond my skill level, sorry!
It's not a perfect solution, but you can change the browser that the Chrome-related actions target by setting two hidden preferences -- see "Change which Chrome-based Browser will be targeted" section of the manual's Preferences Set by Command Line section.
At least that way you test a single alternative Chromium-based browser at a time without having to change your macros.
intro Terminal resulted in all Google Chrome actions in KM being converted to Safari actions, and then they don't work. Worse, I can't get any browser actions to work at all now after several restarts and issuing the "# ~~~ Restore to Google Chrome ~~~" commands in Terminal. Now KM won't do anything with a browser.
Reverting via File > Revert Macros doesn't restore the Chrome-now-Safari actions, even when reverting to more than a week back. It's as if KM has replaced all the Chrome actions via search and replace with Safari actions. Not exactly what I wanted.
How can I get macros back to before Safari replaced everything Chrome replacing the Chrome string with Brave?
The commands only affect the AppleScript code that is used, and the display.
Did you write to other preferences? Perhaps you made changes to the equivalent BrowserSafariName? That would explain why reverting your macros makes no difference.
You can also look at the XML of the action.
The Safari ones have WebBrowser key set to Safari.
I understand that that's not supposed to happen, but it did.
Update: reverting to last week's macros three times via File > Revert Macros, and restarting in between, solved the Safari-replaced-Chrome Actions in all existing macros. They are back to Chrome actions now.
I'm back to square one with trying to replace Chrome with Brave on existing actions.
Given that an unintentional action occurred--Safari replaced Chrome in existing actions, which is what I want to happen but with a different browser than Safari--can you help me with how to deliberately replace existing Chrome actions with Brave actions?
A related but different problem occurred when I tried to reset Safari. I'll post about that under a different topic.
Yeah, KM was definitely misbehaving. Reverting all macros a few times and then resetting all the browser preferences per Peter's instructions eventually fixed it all. (I had actually documented my step-by-step actions that lead to the problems, and then the same for fixing it, [I'm a software book author, so I'm in the habit of writing step-by-steps] but I didn't want to clutter this thread with them.)
Is that a new action or were you able to get Brave as an action that replaced an existing Chrome action?
I was able to get Brave to replace Chrome for new actions, but not for existing actions, which I'm hoping to not have to rebuild one by one. I have a lot of New Tab with specific URLs for weekly research (about 24 tabs across two subjects/tasks), which I mostly automate by listing them in a variable and doing a For Each, but then I've got another 30 or so New Window or New Tab with specific URL actions as standalones I'd have to rebuild via New Action, copy, paste, disable old Chrome action.
Instantly effective, and working on existing macros' actions without me having to do anything but the Terminal commands. Note that the Editor UI won't update an existing action unless you interact with it, for example by switching to another macro and back.
All that is as I would expect. The action itself contains no information about the browser to be used (the XML remains the same). As I understand it, the action is simply "Do this action in the default Chromium browser" -- the Engine determines the browser to use from the AppleScriptGoogleChromeBundlleID plist entry and targets the osascript command appropriately. And the Editor UI is built on the fly from the action's XML, the default action name based on the BrowserGoogleChromeName plist entry.
So everything is mediated by the plist entries, no need to update previously-added actions (except the action's name, if you've customised it).
And yes, that means you can set:
defaults write com.stairways.keyboardmaestro.engine BrowserGoogleChromeName -string "Chrome, although it sucks,"
Is it still the case that, after you've set Brave to be the default Chromium browser, the appropriate action added to a new macro works correctly? What about a new action added to an old macro that already contains other browser-targeting actions?
You do have an extra linefeed at the end of your Terminal commands -- while I don't know that that would cause problems, it would be good to avoid those just to be sure.