Embed weblink within a hotstring script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DevinC
Posts: 10
Joined: 01 Sep 2016, 15:11

Embed weblink within a hotstring script

13 Apr 2021, 14:40

Hello,

How do I embed the URL within the hotstrings script? I'd like the text output to have a clickable text and does not necessarily to display the full URL.

For example,
::helloworld::
(
See AutoHotkey website here
)
Note: "here" is clickable to visit the website www.autohotkey.com
The output should show with clickable link within the rich text editor or when composing an email:
See AutoHotkey website here
Thanks,

Devin
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Embed weblink within a hotstring script

13 Apr 2021, 15:43

DevinC wrote:
13 Apr 2021, 14:40
How do I embed the URL within the hotstrings script? I'd like the text output to have a clickable text and does not necessarily to display the full URL.

This can be done by putting HTML on the clipboard. You can put HTML on the clipboard by using WinClip.

Then the clipboard handles all the magic of knowing how to format data depending on the location it is pasted.

Here is some example code:

Code: Select all

; https://autohotkey.com/board/topic/74670-class-winclip-direct-clipboard-manipulations/

#Include <WinClipAPI>
#Include <WinClip>

#f12::
	WinClip.Clear()
	WinClip.SetText("www.ahkscript.org")
	WinClip.SetHTML("<a href=""http://www.ahkscript.org"">Linky to AHK</a>")
	WinClip.Paste()
return

#f11::
	WinClip.Clear()
	WinClip.SetBitmap(A_Desktop "\Temp\1024x1024.jpg")
	WinClip.Paste()
return

#f10::
	Picture := A_Desktop "\Temp\1024x1024.jpg"
	html=
	(
	<font size="2" face="Calibri" color="black">
	<p>Best Regards,<br>Have a nice day!<br>More Greetings and e-mails and that sort of stuff<br><br>
	<b><font size="2">
	Your Name</b><br>
	<a href="mailto:[email protected]">[email protected]</a><br>
	<img src=%Picture% alt="My picture";">
	)
	WinClip.SetHTML(html)
	WinClip.Paste()
return

::OS::
	WinClip.Clear()
	WinClip.SetText("Best Regards,`nHave a nice day!`nMore Greetings and e-mails and that sort of stuff`n`n")
	WinClip.Paste()
	WinClip.Clear()
	WinClip.SetBitmap(A_Desktop "\Temp\1024x1024.jpg")
	WinClip.Paste()
return

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, mikeyww and 305 guests