I created a script that inserts today's date in any Windows application. I would like to control the format such as font and/or color when I paste it into the target application. I can't seem to find it in the documentation or in any of the help forums.
Formatted text can be stored in the clipboard using AutoHotkey 1.1 (a.k.a. AutoHotkey_L) and a script called WinClip:
#Include WinClipAPI.ahk
#Include WinClip.ahk
; Format the current time.
FormatTime time
; Clear previous clipboard contents.
WinClip.Clear()
; Store time on clipboard, in plain text, RTF and HTML formats.
WinClip.SetText(time)
WinClip.SetRTF("{\rtf{\b " time "}}")
WinClip.SetHTML("<b>" time "</b>")
Some programs will only accept specific formats. Plain text is needed for programs which don't allow formatting, while RTF works in Wordpad and HTML works in Word. RTF also works in Word, but I found that it changed the font to Times New Roman (when HTML wasn't present).
Once it is stored on the clipboard, WinClip.Paste()
or Send ^v
will paste it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With