<< 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.
Jan 6, 2021  • #1
Thomas Malloch (BFS)'s profile on WallpaperFusion.com
I was able to put together a Macro that should work for you. You should be able to copy a url at some point, then highlight some text. Once you hit the hotkey, the macro will automatically turn the highlighted text into a link with your previously copied url. Here's how to get it set up:

  • Download the file attached to this post
  • Open the ClipboardFusion Settings window
  • On the "Macros" tab, click the "Import" button
  • Select the file you downloaded in the first step
  • In the window that pops up, you can review the code and assign the Macro a HotKey
  • Click OK to close the Macro Edit window, then OK again to save and apply your changes

• Attachment: Search for URL and Make Anchor.cfmacro [9,120 bytes]
Jan 25, 2021  • #2
Was this helpful?    
<< DiscussionsReply