OK, after much help from @ComplexPoint, @peternlewis, & @ccstone, I have compiled an AppleScript that achieves #1 on my ideal solution list: Copy selection of hyperlink from any document and convert into clean RTF hyperlink and Plain Text Markdown Link.
Download the AppleScript from here:
CB MD Put Hyperlink & MD Link on Clipboard.scpt.zip (15.8 KB)
Here's just the top of the file:
property gstrScriptName : "CB MD Put Hyperlink & MD Link on Clipboard"
property gstrScriptVer : "BETA 0.2"
property gstrScriptDate : "Wed, Jul 22, 2015"
STATUS: This script is BETA. It is INCOMPLETE and is a work in progress. Use for testing/commenting only.
• Based on the User's selection, create and put on Clipboard:
• RTF formatted Hyperlink
• Plain Text Markdown text for hyperlink
• The data for the OUTPUT hyperlinks will be determined as follows:
1st BETA • IF Selection is a RTF/HTML Hyperlink from a Web page or RTF document
• URL = URL of the hyperlink
• Link Text = Link Text of the hyperlink
NOT Done • IF Selection is only Text with no link:
• Link Text = Selected text
• URL =
• IF Web page, THEN URL of page
• ELSE set to "NoURL"
NOT Done • IF NO Selection is made AND Current App is a Web app:
• Link Text = Web page Title
• URL = Web page URL
NOT Done • IF NO Selection is made AND Current App is NOT a Web app:
• Display ERROR msg, asking user to select a hyperlink or a web page.
It is still very much a BETA, actually an ALPHA, since it is INCOMPLETE, and has had only very limited test. I have NOT yet put any error checking/handling into it.
If anyone has a better RegEx pattern, please let me know.
This requires Satimage AppleScript Extensions
Please give me your bug reports, comments, suggestions, improvements. Feel free to be as blunt as you'd like -- I have a thick skin. I just want to make this be a great tool for all of us.
As I said, it is INCOMPLETE and doesn't have any error checking/handling.
It is a rough draft of the 1st use case. At this point I'm not sure what the best integration with KM is, so let me know if you have any ideas about that.
I decided not to post the code here because it is so long due to header comments. It's about 4 screen, but I have a lot of comments and white space.
You guys let me know if you'd like it posted here.