hoytdj
hoytdj

Reputation: 164

How to format clipboard text to paste as hyperlink?

How can I generate a rich text hyperlink on my clipboard using something like autohotkey?

Basically I want to create a paste as hyperlink shortcut. Currently I highlight some text and press ctrl+alt+k which sends ctrl+k (create hyperlink hotkey in many programs), then sends ctrl+v to paste in my location, and finally enter to confirm.

This works well enough but I was hoping to make it general enough to work anywhere that supports rich text, even if it doesn't have a ctrl+k shortcut available.

Thanks, David

Upvotes: 1

Views: 1975

Answers (1)

Robert Ilbrink
Robert Ilbrink

Reputation: 7953

Simple code:

In this example I use Ctrl+Shift+v to paste a hyperlink in your format:

^+v::
Send, ^k %Clipboard% {Enter}
Return

or...

^+v::
StringReplace, ClipBoard, ClipBoard, http://  ; strip  http://
StringReplace, ClipBoard, ClipBoard, https://  ; strip  http://
Send, <a href="http://%ClipBoard%">%ClipBoard%</a>
Return

Upvotes: 1

Related Questions