I've been looking in the forum but can't find quite an example like what I need. I use Outlook mail for work, I receive a lot of emails containing google drive docs, every time I click on them they open in safari (my preferred browser), but my personal google account is signed in rather than my work account, then I have to switch accounts every time.
To prevent all this, I just logged into my work account in chrome, but I have been copying and pasting links from outlook into chrome, I'm pretty sure there has to be a better way to do it via KM but I have a hard time creating the macro. I want it to only work in Outlook and whenever I click a URL (if it could be simplified to only google URLs it would be even better).
Macro Groups control when their contained macros are active, and you can configure a macro group to be active only within a specific application. See the Quick Start and Macro Groups user manual sections.
There is no way to detect when you click a URL.
Assuming you are hovering over a link, you could probably write a hot key along the lines of:
Control-Click at the current cursor location
Short Pause
Insert Text by Typing "Copy as URL" (or whatever is required to drive the contextual menu to copy the link URL).
While KM can't detect when you click on a link, KM can use AppleScript to get the Google Drive URLs that are in the Outlook body, and then open them in Chrome (or any Browser). This requires the use of RegEx.
If you will view the Source of an example Outlook message, save to a text file, zip, and post here, I'll take a look at it. It the Source contains sensitive info, you can delete that as long as you leave intact a large block of HTML around the Google links.