I've gone through a bunch of posts here and as I'm merely a tinkerer and not a dev, much of it has gone over my head. I've spent about an hour now trying to do this and hope someone can help me. I use Chrome on Mac Sequoia.
I want to press a keyboard shortcut like CTRL + Q and have it copy the URL of the current browser tab and then paste it as a formatted link, always using the word "link". Like this: Link
... but to be honest, I feel like they're more complex than I need or else I'm not understanding what they say. The first one I need to install or use Python, which I don't know the first thing about.
Now, I can't get it to work at all. I tried the debugger but it doesn't show anything that seems helpful. I have deleted the macro and redownloaded it several times. It doesn't change anything. It's still not working.
It's clear it's not grabbing the URL because these should be filled in.
If I'm understanding this properly, you want to always create a Markdown-style link with the link text being a word ("Link"), and have that on the clipboard? If that's right, this simple one-action macro should do what you want:
This uses the %FrontBrowserURL% token, which does what its name suggests, and formats it in Markdown style directly to the clipboard. Change "Link" to whatever you want.
If this isn't what you want, there are other more-powerful link creation tools here, including one I wrote:
That gives me this - the actual code for the URL in HTML. Discourse formats it but the platform I'm in does not support Markdown, so this code doesn't help.
The problem with this, at least as I understand it, is that it requires knowing what the destination app expects a link to be. Some apps (Discord) will format a link when the text is input in the right form. Other apps (Word) require you to click on a selection of text and go through the process of inserting the link.
So in whatever app you're using, how do you create a link in that app? That's the behavior you'll have to replicate with Keyboard Maestro. There's no such thing as a "universal hyperlink," at least to my knowledge—hopefully someone will correct me if I'm wrong.
Hi, @lady3jane. If you upload your macro, I can help you out later today.
Thanks to some JXA code that I have borrowed from @ComplexPoint, I have a few macros that populate the clipboard with links. When the links are pasted into a text editor, they take the form of markdown, i.e., [title](url), whereas when pasted into an rich text editor (e.g., TextEdit, Word, Mail), the links are pasted as hyperlinks.
Then that should be even simpler: Take the macro I posted earlier, and just change it to this:
%FrontBrowserURL%
Then add a second action, Paste. Assign a keyboard shortcut, and if you have text highlighted in your app, when you hit the shortcut, the frontmost browser's URL should be inserted as a formatted link.
Please note that this depends on your app behaving exactly as you described: With a URL on the clipboard, and text selected in the app, pressing Command-V (or Edit > Paste) results in a clickable link with the selected text. If that's true, then the above should work perfectly for you.
It can get fancier if you want to be in your browser when you run it, but for now, it's set up to simply grab whatever the frontmost browser window is while you're in your app.