Jump to content

formatted text for putting it to the clipboard


Recommended Posts

Hi,

from other postings here as a start I'm quite Close to my Goal of putting formatted text to the clipboard:

#include-once
#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Global $g_idLblMsg, $g_hRichEdit

Example("The first text will be formatted ""as is""" & @CRLF & _
        "(Default Font and font size)", "This text is formatted differently")

MsgBox(0, "Rich Text copied", "Formatted Text put to clipboard")

Func Example($TextDefault, $TextCourier)
    Local $hGui, $iMsg, $idBtnNext, $iStep = 0
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
    $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, $TextDefault, 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    $g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
    GUISetState(@SW_SHOW)
    _GUICtrlRichEdit_SetSel($g_hRichEdit, -1, -1) ; set selection behind last CHAR in RTF_EDIT
    _GUICtrlRichEdit_SetFont($g_hRichEdit, 8, "Courier New") ; change font to 8pt, Courier New
    _GUICtrlRichEdit_AppendText($g_hRichEdit, @CRLF & $TextCourier)
    _GUICtrlRichEdit_SetSel($g_hRichEdit, 0, -1) ; select all the content of the RTF_EDIT
    _GUICtrlRichEdit_Copy($g_hRichEdit) ; put the selection to the clipboard
EndFunc   ;==>Example

 

Finally the clipboard content has to hold pre-formatted data to be pasted into an email body. for the 2nd part I'd like to add a frame around the text, like I did manually before taking this screenshot.

Formatted-Text-to-Clipboard.jpg.a4f7fcf9630ffe734ecc4f81ce2dc797.jpg

Any suggestions, or maybe some absolutely different Approach?

 

CU, Rudi.

Edited by rudi
<autocorrect typos>

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...