Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.43 KB | None | 0 0
  1. #include <WinAPI.au3>
  2. #include <GDIPlus.au3>
  3. $i = 0
  4. $title=InputBox("Zeitversetztes Screencapturen","Den Anfang des Fenstertitels eingeben","")
  5. If @error Then Exit MsgBox(0,"Tja.","Dann halt nicht.")
  6. $min=InputBox("Zeitversetztes Screencapturen","Wie oft soll gescreencaptured werden? (Alle wieviel Minuten?) Auch Float möglich.","")
  7. If @error Then Exit MsgBox(0,"Tja.","Dann halt nicht.")
  8. _GDIPlus_Startup()
  9. $hWnd = WinGetHandle(WinGetTitle($title))
  10. If not FileExists(@ScriptDir & "\screenshots\") Then DirCreate(@ScriptDir & "\screenshots")
  11. While 1
  12.     Sleep(60000*$min)
  13.     $hBMP = _ScreenCapture_CaptureWndEx($hWnd, -1, -1)
  14.     $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
  15.     $i += 1
  16.     _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Screenshots\" & $i & ".png")
  17.     _GDIPlus_BitmapDispose($hBitmap)
  18.     _WinAPI_DeleteObject($hBMP)
  19. WEnd
  20.  
  21. _GDIPlus_Shutdown()
  22.  
  23.  
  24. Func _ScreenCapture_CaptureWndEx($hWnd, $iWidth = -1, $iHeight = -1)
  25.     If $iWidth = -1 Then $iWidth = _WinAPI_GetClientWidth($hWnd)
  26.     If $iHeight = -1 Then $iHeight = _WinAPI_GetClientHeight($hWnd)
  27.  
  28.     Local $hDDC = _WinAPI_GetDC($hWnd)
  29.     Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC)
  30.     Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iWidth, $iHeight)
  31.     _WinAPI_SelectObject($hCDC, $hBMP)
  32.     _WinAPI_BitBlt($hCDC, 0, 0, $iWidth, $iHeight, $hDDC, 0, 0, 0x00CC0020)
  33.  
  34.     _WinAPI_ReleaseDC($hWnd, $hDDC)
  35.     _WinAPI_DeleteDC($hCDC)
  36.     Return $hBMP
  37. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement