I don't know of any good way of doing this, but here is a hack way to works for the most part.
Basically, it takes the URL and the text, and writes them to a temporary RTF file, and then reads that RTF into the clipboard.
There are so many gotchas and caveats with this though.
The main usage caveat is that the text must contain only valid stuff that can go raw in an RTF file. Basically, I wouldn't try much other than plain letters and spaces (probably numbers are OK). Anything else and you may have to encode it and frankly I have no idea how you encode things in an RTF file.
The macro is relatively straight forward - write the raw RTF data to a temporary file, read it to the clipboard. However it is surprisingly hard to actually construct this macro for a number of technical reasons.
- The RTF is in a text token processed field, so all the backslashes (of which there are lots) have to be doubled.
- Keyboard Maestro wont let you write raw text to a file with extension "rtf". If you set the extension to rtf it sets the format to RTF (which means you would get formatted RFC codes, not helpful!). If you change the format to Plain Text, it changes the extension to "txt". So you have to force the issue by putting the path (or at least the extension) in a variable.
- The Write file (like most fields) has smart quotes substitution enabled, so the quotes get changed from valid straight quotes to curly quotes if you look sideways at it.
But after all that you end up with the link text on the clipboard, then you can do whatever you want with it, for example:
Create Link.kmmacros (3.6 KB)
