Wiedereinmal ein Skript, das es schon einige Male gibt, aber ich will immer alles auf meine Art machen ![]()
Zuerst Bereich markieren, F9 für Screenshot, Esc für Ende.
Viel Spaß damit!
Spoiler anzeigen
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $xStart = 0, $yStart = 0, $xStopp = 0, $yStopp = 0
Global $title = 'Screenshot markieren'
If Not IsDeclared("SM_VIRTUALWIDTH") Then Global Const $SM_VIRTUALWIDTH = 78
If Not IsDeclared("SM_VIRTUALHEIGHT") Then Global Const $SM_VIRTUALHEIGHT = 79
Global $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH)
$VirtualDesktopWidth = $VirtualDesktopWidth[0]
Global $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT)
$VirtualDesktopHeight = $VirtualDesktopHeight[0]
GUICreate($title, $VirtualDesktopWidth, $VirtualDesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUIRegisterMsg(0x0201, '_WM_LBUTTONDOWN') ;$WM_LBUTTONDOWN
GUIRegisterMsg(0x0202, '_WM_LBUTTONUP') ;$WM_LBUTTONUP
;~ GUIRegisterMsg(0x0204, '_WM_RBUTTONDOWN') ;$WM_RBUTTONDOWN
WinSetTrans($title, "", 30)
[/autoit] [autoit][/autoit] [autoit]If Not FileExists(@ScriptDir & "\Screenshots") Then DirCreate(@ScriptDir & "\Screenshots")
Global $hGraphic = GUICtrlCreateGraphic(0, 0, $VirtualDesktopWidth, $VirtualDesktopHeight)
GUICtrlSetBkColor(-1, 0xffffff)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetGraphic(-1, $GUI_GR_PENSIZE, 2)
GUISetState()
HotKeySet('{F9}', '_Make_Screenshot')
HotKeySet('{ESC}', '_quit')
While 1
Sleep(100000)
WEnd
Func _quit()
Exit
EndFunc ;==>_quit
Func _WM_LBUTTONDOWN($hWnd, $msg, $wParam, $lParam)
Local $fwKeys = $wParam, $xPos = BitAND($lParam, 0xFFFF), $yPos = BitShift($lParam, 16)
GUICtrlSetGraphic($hGraphic, $GUI_GR_COLOR, 0xffffff)
GUICtrlSetGraphic($hGraphic, $GUI_GR_RECT, $xStart, $yStart, $xStopp - $xStart, $yStopp - $yStart)
;~ GUICtrlSetGraphic($hGraphic, $GUI_GR_REFRESH)
$xStart = $xPos
$yStart = $yPos
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_LBUTTONDOWN
Func _WM_LBUTTONUP($hWnd, $msg, $wParam, $lParam)
Local $fwKeys = $wParam, $xPos = BitAND($lParam, 0xFFFF), $yPos = BitShift($lParam, 16)
$xStopp = $xPos
$yStopp = $yPos
GUICtrlSetGraphic($hGraphic, $GUI_GR_COLOR, 0x0)
GUICtrlSetGraphic($hGraphic, $GUI_GR_RECT, $xStart, $yStart, $xStopp - $xStart, $yStopp - $yStart)
GUICtrlSetGraphic($hGraphic, $GUI_GR_REFRESH)
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_LBUTTONUP
;~ Func _WM_RBUTTONDOWN($hWnd, $msg, $wParam, $lParam)
;~ Local $fwKeys = $wParam, $xPos = BitAND($lParam, 0xFFFF), $yPos = BitShift($lParam, 16)
;~ GUICtrlSetGraphic($hGraphic, $GUI_GR_COLOR, 0xffffff)
;~ GUICtrlSetGraphic($hGraphic, $GUI_GR_RECT, $xStart, $yStart, $xStopp - $xStart, $yStopp - $yStart)
;~ GUICtrlSetGraphic($hGraphic, $GUI_GR_REFRESH)
;~ Return $GUI_RUNDEFMSG
;~ EndFunc ;==>_WM_RBUTTONDOWN
Func _Make_Screenshot()
Local $x1, $x2, $y1, $y2
Select
Case $xStart < $xStopp
$x1 = $xStart
$x2 = $xStopp
Case $xStart > $xStopp
$x1 = $xStopp
$x2 = $xStart
EndSelect
Select
Case $yStart < $yStopp
$y1 = $yStart
$y2 = $yStopp
Case $yStart > $yStopp
$y1 = $yStopp
$y2 = $yStart
EndSelect
If $x1 > 0 And $x2 > 0 And $y1 > 0 And $y2 > 0 Then _ScreenCapture_Capture(@ScriptDir & "\Screenshots\Screenshot" & @YEAR & @MDAY & @WDAY & "_" & @HOUR & @MIN & @SEC & ".jpg", $x1, $y1, $x2, $y2, False)
EndFunc ;==>_Make_Screenshot
;~ MK_LBUTTONUP The left mouse button is up. --> 0x00
;~ MK_LBUTTON The user pressed the left mouse button. --> 0x01
;~ MK_RBUTTON The user pressed the right mouse button. --> 0x02
;~ MK_SHIFT The user pressed the SHIFT key. --> 0x04
;~ MK_CONTROL The user pressed the CTRL key. --> 0x08
;~ MK_MBUTTON The user pressed the middle mouse button. --> 0x10