例如
这
这些快捷方式都不是你在 Windows 中通过几次点击或使用第三方小应用程序无法实现的,但是http://JDContextMenu.com只需单击一下即可将它们捆绑到一个小菜单中。您可以复制完整的[电子邮件保护]到剪贴板
应该转换成这个
None of the shortcuts are things you couldn't do within Windows with a few extra clicks or with a small 3rd-party app, but <a href="http://JDContextMenu.com" title="Opens in a new window" target="_blank">http://JDContextMenu.com</a> bundles them together into a small menu with one-click ease. You can copy the full <a href="mailto:[email protected]">[email protected]</a> to the clipboard
我想将此功能与此脚本结合起来如何选择文本然后使用 html 标签进行转换?
答案1
此 AutoHotkey 脚本应该可以工作,识别 URL 和电子邮件地址。
ALT+p是定义的热键:
!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