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.
Any suggestions, or maybe some absolutely different Approach?
Here some graphical examples written completely in FreeBasic just for fun.
_WinAPI_SetWindowTitleIcon Check for Numeric Entry in an EditBox using RegEx CreateWindowEx (hGUI) Example FB 3D Starfield Rotating Flight FB File2Bas Code Generator FB Fire Particles FB Fireworks FB GFX Examples FB Image to Trapezoid Transformation FB Layered Parallax Effect FB Plasma FB Puristic Clock FB Rotating Cube FB Rotating Earth FB Rutt Etra Izer Effect FB Simple Recursive Tree Generator FB Snowfall FB Tunnel Flight FB Water Effect FMOD Examples GDI - GDI+ 3D Sinus Wave GDI - GDI+ Animated Pythagoras Tree GDI - GDI+ Bezier Lines GDI - GDI+ Particles - Repulsive Force Sim v2.0 GDI - GDI+ Plasma v5 Booster GDI - GDI+ Random Pattern GDI - GDI+ Space Flight GDI - GDI+ Tunnel Flight - WipeOut Style GDI Classic Raytraced Tunnel GDI Elastic Twister Effect GDI Exploding Pixels GDI Infinite Image Zoom Flight GDI Liquid Pixels GDI Mandelbrot GDI Particle Repulsion Grid GDI Particles Mouse Attraction GDI Starfield GDI The Nautilus Raymarcher GDI Worm Tunnel Flight GDI+ 3D Starfield Scrolling v1 Booster GDI+ 3D Starfield Scrolling v3 Booster GDI+ Convert Bitmap to ASCII GDI+ GIF Anim to ASCII Player GDI+ Image Painting GDI+ Impossible Possible GDI+ Kaleidoscope GDI+ Performance Test - Au3 vs FB GDI+ Polar Clock GDI+ Rotating Earth GDI+ Spiral Text GDI+ Star Wars Scroller GDI+ Streamer GDI+ Swiss Railway Clock GDI+ The MATRIX Ini Read - Write Rutt_Etra_Izer_Booster Stack TitchySID uFMOD
Download: FreeBasic Examples build 2019-05-08.rar
I will add new examples from time to time.
FreeBasic source codes are also included.
hello Im wondering if it is possible to process image in autoit like this
1. firstly there is colorfull wallpaper
2. Fill all colors (exception rose color) - with white
3. Fill rose color with black color
I see Gdi functions have things to manipulate images
Programs like Ditto are a great augmentation to the Windows clipboard where it keeps a list of items you copy and paste and you can go back to days, weeks, months later. It also comes in handy for multiple copied items you need to paste over and over again.
Windows 10 also now has a clipboard history capability (though not as robust, I think, as Ditto).
I would like to simulate this type of clipboard history into my own apps independent of Windows' clipboard, but I haven't a clue as to where to begin.
Thank you in advance for any suggestions, examples, shelved codes. ☺
I'm creating a tool which automatically saves screenshots. I've found that some images appear corrupt after saving. I've narrowed the source down to screenshots taken from within an RDP session via the Ctrl+Alt+Plus (PrtScn equivalent) and Ctrl+Alt+Minus (Alt+PrtScn equivalent) key combos.
Here is the example code:
#include <ClipBoard.au3> #include <GDIPlus.au3> If _ClipBoard_IsFormatAvailable($CF_BITMAP) Then ConsoleWrite("+Bitmap found on Clipboard" & @CRLF) If Not _ClipBoard_Open(0) Then MsgBox(16, "Error", "_ClipBoard_Open failed") Exit EndIf $hClipboardImage = _ClipBoard_GetDataEx($CF_BITMAP) _ClipBoard_Close() _GDIPlus_Startup() $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hClipboardImage) $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") _GDIPlus_ImageSaveToFileEx($hBitmap, @ScriptDir & "\" & TimerInit() & "_Clipboard_Image.jpg", $sCLSID, 0) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() Else MsgBox(48, @ScriptName, "No Bitmap found on Clipboard") EndIf If you copy a local window to the clipboard via Alt+PrtScn the above works fine. If you copy a window in an RDP session via Ctrl+Alt+Minus it saves the image, but the left-hand edge appears to contain a few pixels sliced off the right-hand side of the bitmap (see two attached images for examples; one good, one bad). If you paste directly into MSPaint, the image appears correctly, so the clipboard contents is good. It seems to be the process of converting the bitmap handle to an image file via GDIPlus which corrupts it (though I may be wrong about this).
I've tried inspecting the contents of the clipboard via the _ClipBoard_EnumFormats example and I've noticed the clipboard from the RDP session contains a couple more formats;
Clipboard formats ..: 3 Clipboard format 1 .: Bitmap Clipboard format 2 .: DIB Clipboard format 3 .: DIB V5 RDP:
Clipboard formats ..: 5 Clipboard format 1 .: DataObject Clipboard format 2 .: DIB Clipboard format 3 .: DIB V5 Clipboard format 4 .: Ole Private Data Clipboard format 5 .: Bitmap However the _ClipBoard_GetDataEx function is specifying the $CF_BITMAP constant for the format, which both instances contain, so I'm not sure the extra formats have any impact?
I've tried using a combination of _ClipBoard_GetDataEx($CF_DIB) and _GDIPlus_BitmapCreateFromMemory in an effort to write the binary directly to a file, instead of using a bitmap handle, however this doesn't appear to work and just returns a zero and doesn't set @error to anything, which isn't covered in the help file (a failure should return a zero and set the @error level to something).
I've hunted around the forums and tried everything I can think of. I can normally figure most things out without posting but I've been dipping in and out of this script for a few months now and have finally thrown in the towel and must ask you guys for help, which isn't a decision I take lightly. Your help is, as always, greatly appreciated.