<< DiscussionsReply

macro to make links from text

Avatar from Gravatar.com
Andrew Brown6
2 discussion posts
I apologise if this is a stupid question, but has anyone written a macro to wrap the selected text in html to make it into a link?

I have done this myself in a couple of scripting languages for other programs - autohotkey on windows and keyboard maestro on the mac, but I am not a real programmer and C# defeats me.

The algorithm is simple enough:
  • take the selected text and store it for a moment
  • search the clipboard history backwards for the first Url

  • prefix the text selection with '<a href="{foundurl}>"'
  • add the {selectedText} and then "</a>"
  • Paste the whole lot back, replacing the selected text

What would this look like in C#? I can't believe I am the first person to want to do this.
10 days ago  • #1
Was this helpful?    
<< DiscussionsReply