Home » Questions » Computers [ Ask a new question ]

if selected text has site url and email address then i want to convert all url and email address into link?

if selected text has site url and email address then i want to convert all url and email address into link?

for example

Asked by: Guest | Views: 346
Total answers/comments: 1
Guest [Entry]

"This AutoHotkey script should work, identifying both URLs and email addresses.

ALT+p is the hotkey defined:

!p::
ClipSaved := ClipboardAll
Clipboard=
Send ^c
ClipWait, 2
clipcontent = %Clipboard%
; Regular Expressions from RegExLib.com
; First lets search for the URLs
clipcontent := RegExReplace(clipcontent, ""Si)(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?"", ""<a href=""""$0"""">$0</a>"")
; And then for the email addresses
clipcontent := RegExReplace(clipcontent, ""Si)[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))"", ""<a href=""""mailto:$0"""">$0</a>"")
Clipboard = <p>%clipcontent%</p>
ClipWait, 2
Send ^v
Clipboard := ClipSaved
ClipWait, 2
ClipSaved=
return"