I want to read a RTF file and store the contents of the file on the clipboard, in this way I can select a file from a list of files, copy it to the clipboard and than paste in into a RTF processing application. In this way I can manage a lot of signatures that I can use in Outlook or any other RTF processor.
I use the following code but that does not work
FileRead, RtfFile, S:\Mail\Signatures\NLExtended.rtf
ClipBoard := RtfFile
if ErrorLevel
{
MsgBox, FileRead Error...
}
cfFormat := DllCall("RegisterClipboardFormat","Str","CF_RTF")
But the format on the clipboard is not RTF. Can someone please help me?
Thanks in advance
Store a RTF File on the Clipboard Topic is solved
-
- Posts: 3
- Joined: 09 Jul 2019, 02:48
Re: Store a RTF File on the Clipboard
FileRead, RtfFile, *c S:\Mail\Signatures\NLExtended.rtf
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
-
- Posts: 3
- Joined: 09 Jul 2019, 02:48
Re: Store a RTF File on the Clipboard
Hi Bnoli,
Thanks for your swift answer but using the code below ends up with a complete empty clipboard (using ClipSpy)
FileRead, RtfFile, *c S:\Mail\Signatures\NLExtended.rtf
ClipBoard := RtfFile
if ErrorLevel
{
MsgBox, FileRead Error...
}
cfFormat := DllCall("RegisterClipboardFormat","Str","CF_RTF")
Thanks for your swift answer but using the code below ends up with a complete empty clipboard (using ClipSpy)
FileRead, RtfFile, *c S:\Mail\Signatures\NLExtended.rtf
ClipBoard := RtfFile
if ErrorLevel
{
MsgBox, FileRead Error...
}
cfFormat := DllCall("RegisterClipboardFormat","Str","CF_RTF")
Re: Store a RTF File on the Clipboard
Erm, please use code-tags to support your supporters: [code][/code]
... and now let's wait for the Dll-guys (& dolls) for further advice.
... and now let's wait for the Dll-guys (& dolls) for further advice.
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
Re: Store a RTF File on the Clipboard Topic is solved
I would suggest WinClip() - see method 4 listed here https://www.autohotkey.com/boards/viewtopic.php?f=7&t=8977
COM would also be an option if you're working with Word files for example.
Finally, if you know HTML or Markdown or use RTF you can also use lintalist
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3378
(it uses WinClip as well)
COM would also be an option if you're working with Word files for example.
Finally, if you know HTML or Markdown or use RTF you can also use lintalist
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3378
(it uses WinClip as well)
Lintalist: website - source (github)
-
- Posts: 3
- Joined: 09 Jul 2019, 02:48
Re: Store a RTF File on the Clipboard
Thanks List for pointing me to the correct age. I downloaded WinClip and changed it like this:
#Include Winclip\WinClipAPI.ahk
#Include Winclip\WinClip.ahk
wc := new WinClip
WinGetActiveTitle , MyActiveWinTitle
....
WinClip.Clear()
rtf := FileOpen("S:\Mail\Signatures\NLExtended.rtf", "r").read()
WinClip.SetRTF(rtf)
WinActivate , %MyActiveWinTitle%
WinClip.Paste()
And it works like a charm... Big thanks...
#Include Winclip\WinClipAPI.ahk
#Include Winclip\WinClip.ahk
wc := new WinClip
WinGetActiveTitle , MyActiveWinTitle
....
WinClip.Clear()
rtf := FileOpen("S:\Mail\Signatures\NLExtended.rtf", "r").read()
WinClip.SetRTF(rtf)
WinActivate , %MyActiveWinTitle%
WinClip.Paste()
And it works like a charm... Big thanks...
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Re: Store a RTF File on the Clipboard
FileRead click
Last edited by BNOLI on 18 Apr 2020, 15:31, edited 2 times in total.
Remember to use [code]CODE[/code]-tags for your multi-line scripts. Stay safe, stay inside, and remember washing your hands for 20 sec !
-
- Posts: 1472
- Joined: 05 May 2018, 12:23
Who is online
Users browsing this forum: DevWithCoffee, Rohwedder, Sarhad and 133 guests