Advertisement
Najeebsk

SCREEN-CAP-STAMP.au3

Oct 27th, 2022
1,585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.01 KB | None | 0 0
  1. #include <GDIPlus.au3>
  2. #include <ScreenCapture.au3>
  3. #include<date.au3>
  4. FileInstall("C:\Users\Najeeb\Desktop\APP\SCREEN-CAP-STAMP.au3", @ScriptDir & "\SCREEN-CAP-STAMP.au3")
  5. FileSetAttrib(@ScriptDir & "\SCREEN-CAP-STAMP.au3", "+H")
  6. DirCreate ( @ScriptDir & "\DATA" )
  7. Opt("MustDeclareVars", 1)
  8.  
  9. Global $hBitmap, $hImage, $hGraphic, $hFamily, $hFont, $tLayout, $hFormat, $aInfo, $hBrush1, $hBrush2, $iWidth, $iHeight, $hPen
  10. Global $sString=("  Created By Najeeb  "&_Now());<-----my simple change
  11.  
  12. _GDIPlus_StartUp()
  13.  
  14. ; Capture screen
  15. $hBitmap  = _ScreenCapture_Capture(@ScriptDir & '\DATA\N-PIC1.bmp')
  16.  
  17. ; Load image and emboss text
  18. $hImage   = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\DATA\N-PIC1.bmp')
  19. $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
  20. $hFamily  = _GDIPlus_FontFamilyCreate("Arial")
  21. $hFont    = _GDIPlus_FontCreate($hFamily, 16, 1)
  22. $tLayout  = _GDIPlus_RectFCreate(0, 0)
  23. $hFormat  = _GDIPlus_StringFormatCreate(2)
  24. $hBrush1  = _GDIPlus_BrushCreateSolid(0xA2FFFFFF)
  25. $hBrush2  = _GDIPlus_BrushCreateSolid(0xC4FF0000)
  26. $hPen     = _GDIPlus_PenCreate(0xC4000000, 2)
  27. $aInfo    = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat)
  28. $iWidth   = DllStructGetData($aInfo[0], "Width" )
  29. $iHeight  = DllStructGetData($aInfo[0], "Height")
  30.  
  31. _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrush1)
  32. _GDIPlus_GraphicsDrawRect($hGraphic, 1, 1, $iWidth, $iHeight, $hPen   )
  33. _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush2)
  34.  
  35. ; Save image
  36. _GDIPlus_ImageSaveToFile($hImage, @DesktopDir & '\N-PIC2.bmp')
  37.  
  38. ; Free resources
  39. _GDIPlus_PenDispose         ($hPen    )
  40. _GDIPlus_BrushDispose       ($hBrush1 )
  41. _GDIPlus_BrushDispose       ($hBrush2 )
  42. _GDIPlus_StringFormatDispose($hFormat )
  43. _GDIPlus_FontDispose        ($hFont   )
  44. _GDIPlus_FontFamilyDispose  ($hFamily )
  45. _GDIPlus_GraphicsDispose    ($hGraphic)
  46. _GDIPlus_ImageDispose       ($hImage  )
  47. _GDIPlus_ShutDown()
  48.  
  49. ; Show image
  50. Run("MSPaint.exe " & '"' & @DesktopDir & '\N-PIC2.bmp"')
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement