sigil Posted May 18, 2009 Share Posted May 18, 2009 I want to put my email address on a screenshot taken by pressing Alt+PrintScrn. The only way I can think of to put this text on the image is to have a script that opens Paint, pastes the screenshot, simulates some clicks to get to text entry mode, and then uses Send() to put the email address on there. This seems unnecessarily complicated, but I haven't been able to find any functions that directly modify the content of graphics stored in the clipboard. Any suggestions? Link to comment Share on other sites More sharing options...
Valuater Posted May 18, 2009 Share Posted May 18, 2009 (edited) I want to put my email address on a screenshot taken by pressing Alt+PrintScrn. The only way I can think of to put this text on the image is to have a script that opens Paint, pastes the screenshot, simulates some clicks to get to text entry mode, and then uses Send() to put the email address on there. This seems unnecessarily complicated, but I haven't been able to find any functions that directly modify the content of graphics stored in the clipboard. Any suggestions?That way is quite easy, however if you want to "script" the actions, you might want to look at _ScreenCapture_Capture()in the help file. then create a GUICreate(), then GuiCtrlCreatePic(), then set the state GUICtrlSetState() as disabled, then create your label.8) Edited May 18, 2009 by Valuater Link to comment Share on other sites More sharing options...
LurchMan Posted May 18, 2009 Share Posted May 18, 2009 (edited) I want to put my email address on a screenshot taken by pressing Alt+PrintScrn. The only way I can think of to put this text on the image is to have a script that opens Paint, pastes the screenshot, simulates some clicks to get to text entry mode, and then uses Send() to put the email address on there. This seems unnecessarily complicated, but I haven't been able to find any functions that directly modify the content of graphics stored in the clipboard. Any suggestions? I use this to put text onto a jpg after using ScreenCapture() expandcollapse popupFunc _EmbossSS($hJPG) GetDateTime() Local $hImage, $hGraphic, $hFamily, $hFont, $tLayout Local $hFormat, $aInfo, $hBrush1, $hBrush2, $iWidth, $iHeight, $hPen $SSDate = StringRegExpReplace(_NowCalcDate(), "\A(\d*)/(\d*)/(\d*)", "$2/$3/$1");Change for what you want to add $SSTime = _NowTime(5);change for what you want to add Local $sString = $SSDate & " @ " & $SSTime;also change here _GDIPlus_Startup() ; Load image and emboss text $sCLSID = _GDIPlus_EncodersGetCLSID("JPG") $hImage = _GDIPlus_ImageLoadFromFile($sSavePath) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 16, 1) $tLayout = _GDIPlus_RectFCreate(0, 0) $hFormat = _GDIPlus_StringFormatCreate(0) $hBrush1 = _GDIPlus_BrushCreateSolid(0xA2FFFFFF) $hBrush2 = _GDIPlus_BrushCreateSolid(0xC4FF0000) $hPen = _GDIPlus_PenCreate(0xC4000000, 2) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) $iWidth = DllStructGetData($aInfo[0], "Width") $iHeight = DllStructGetData($aInfo[0], "Height") _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrush1) _GDIPlus_GraphicsDrawRect($hGraphic, 0, 0, $iWidth, $iHeight, $hPen) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush2) ; Save image _GDIPlus_ImageSaveToFileEx($hImage, $sSavePath2, $sCLSID) ; Free resources _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush1) _GDIPlus_BrushDispose($hBrush2) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() FileDelete($sSavePath) FileMove($sSavePath2, $sSavePath) EndFunc ;==>_EmbossSS The $hJPG comes from the _Capture_ScreenCapture(), if i remember right leave the file name blank and it returns a handle Edited May 18, 2009 by LurchMan Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
TurionAltec Posted May 18, 2009 Share Posted May 18, 2009 (edited) This will put a tooltip at the location of the cursor with an email address then take a screenshot. You'll need additional code to save the screenshot. Or replace the Send() with _ScreenCapture_Capture _ScreenCapture_CaptureWnd _ScreenCapture_SaveImage I'd recommend PNG format for most screenshots except those with a lot of photographic content. HotKeySet("#!{PRINTSCREEN}","screenshot"); Win+Alt+printscreen While 1 sleep(100) WEnd Func screenshot() ToolTip("example@example.com") Send("!{PRINTSCREEN}") Sleep(200) ToolTip("") EndFunc Edited May 18, 2009 by TurionAltec Link to comment Share on other sites More sharing options...
LurchMan Posted May 18, 2009 Share Posted May 18, 2009 This will put a tooltip at the location of the cursor with an email address then take a screenshot. You'll need additional code to save the screenshot. HotKeySet("#!{PRINTSCREEN}","screenshot"); Win+Alt+printscreen While 1 sleep(100) WEnd Func screenshot() ToolTip("example@example.com") Send("!{PRINTSCREEN}") Sleep(200) ToolTip("") EndFunc Either way...I use the GDI+ way just cause my boss likes things to look neat and clean.... Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
sigil Posted May 18, 2009 Author Share Posted May 18, 2009 Thanks for the help from both of you, I'll go with the tooltip for the moment, probably move on to GDIplus when I get a chance to learn it. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now