Sometimes I run Safari, sometimes Brave, sometimes Firefox. Yeah, I have a problem. Any at rate, what I want to create is a macro that copies the URL from the active tab of the most recently active browser and pastes it in whatever text editor I am writing in at the moment.
So if I happen to have Safari open next to a text editor and am typing, a hotkey will grab the URL from there and paste it in where I am currently typing. If it is Brave, it will do the same. The extra tricky bit is sometimes I may have both Safari and Brave running, but I want it to be smart enough to copy the URL from the most recently active browser, which is likely to be the one I have next to the text editor and am copying from.
Of course I could make separate macros for each browser then give them the same hotkey so a palette pops up prompting me to pick the one I want. But if possible I'd like to make the macro smarter than that and automatically pick the most recently active browser. Can anyone suggest any ideas to do this?