Hallo,
ich habe mir ein Array mit $dArray = _ArrayDisplay($aArr, Default, Default, 1)
anzeigen lassen, jedoch kann ich das Fenster nicht mit WinClose($dArray)
schliessen!? Was muss ich nu tun?
Hallo,
ich habe mir ein Array mit $dArray = _ArrayDisplay($aArr, Default, Default, 1)
anzeigen lassen, jedoch kann ich das Fenster nicht mit WinClose($dArray)
schliessen!? Was muss ich nu tun?
Es geht um Schrifterkennung bzw. Schriftartenerkennung...
Ich will in einer Schleife für alle Schriften die ich habe für jeden "Type" einer Schrift bestimmte Daten festhalten. Und dazu gehört auch die Mittellinie.
Die soll das "nackte" Zeichen darstellen, sodass wenn man die Linie "nachgeht" das gescannte "Type" wiedererkannt werden kann.
Neues Edit:
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <Array.au3>
Opt('MustDeclareVars', 1)
Local $hBitmap, $hImage, $sImageType, $iX, $iY, $iXc, $iYc, $iMemo, $iPixelColor, $count, $File, $color1, $oForm, $color, $dc, $setpixel, $realesedc
Local $hGraphic, $hBitmap, $hBackbuffer, $save, $hPen, $hWind, $cPix, $line, $split, $split0, $split12, $split17, $split1, $split2, $split3, $fRand
Local $midY[1]
Local $midX[1]
Local $found[1]
$File = FileOpen(@ScriptDir & "\coords.txt", 2)
$fRand = FileOpen(@ScriptDir & "\cRand.txt", 2)
_Main()
Func _Main()
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\Picaa.jpg')
$sImageType = _GDIPlus_EncodersGetCLSID("JPG")
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
Local $aCoords[$iX][$iY]
$oForm = GUICreate("GDI+", ($iX), ($iY))
GUISetBkColor(0xFFFFFF)
GUISetState()
$hWind = WinGetHandle($oForm)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWind)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
$iPixelColor = Hex(_GDIPlus_GetPixel($hImage, $iXc, $iYc), 6)
If Dec($iPixelColor) < Dec('999999') Then
;$count = $count + 1
;FileWrite($File, $iXc & "," & $iYc & @CRLF)
$aCoords[$iXc][$iYc] = 999999
SetPixel($oForm, $iXc, $iYc, $color)
$hPen = _GDIPlus_PenCreate(0xFF000000);
_GDIPlus_GraphicsDrawLine($hBackbuffer, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
Else
$aCoords[$iXc][$iYc] = 0
EndIf
Next
Next
;$save = _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & '\Image1.jpg')
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;FileClose($File)
_GDIPlus_Shutdown()
_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 999999 Then
If $aCoords[$iXc - 1][$iYc] = 0 Or $aCoords[$iXc + 1][$iYc] = 0 Or $aCoords[$iXc][$iYc - 1] = 0 Or $aCoords[$iXc][$iYc + 1] = 0 Then
$aCoords[$iXc][$iYc] = 777777
FileWrite($fRand, $iXc & "," & $iYc & @CRLF)
EndIf
EndIf
Next
Next
FileClose($fRand)
_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 777777 And $count = 0 Then
$split17 = StringSplit($aCoords[$iXc][$iYc], ',', 1)
$count = $count + 1
For $iYc2 = $iYc To $iY
If $aCoords[$iXc][$iYc2] = 0 Then
$split0 = StringSplit($aCoords[$iXc][$iYc2], ',', 1)
$split1 = StringSplit($aCoords[$iXc][$iYc + 1], ',', 1)
$split2 = StringSplit($aCoords[$iXc][$iYc2 - 1], ',', 1)
$split3 = StringSplit($aCoords[$iXc][$iYc2 - 2], ',', 1)
If $split17[1] <> $split2[1] Then
$aCoords[$iXc][$iYc] = 0
$aCoords[$iXc][$iYc + 1] = 777777
$aCoords[$iXc][$iYc2 - 1] = 0
If $split3[1] = $split17[1] Then
$aCoords[$iXc][$iYc2 - 2] = 777777
$iYc = $iYc2
ExitLoop
EndIf
EndIf
EndIf
Next
EndIf
$count = 0
Next
Next
For $iYc = 0 To $iY - 1
For $iXc = 0 To $iX - 1
If $aCoords[$iXc][$iYc] = 999999 Then
;
If $aCoords[$iXc][$iYc] = 777777 And $count = 0 Then
$count = $count + 1
$split17 = StringSplit($aCoords[$iXc][$iYc], ',', 1)
For $iXc2 = $iXc To $iX
If $aCoords[$iXc2][$iYc] = 0 Then
$split0 = StringSplit($aCoords[$iXc2][$iYc], ',', 1)
$split1 = StringSplit($aCoords[$iXc + 1][$iYc], ',', 1)
$split2 = StringSplit($aCoords[$iXc2 - 1][$iYc], ',', 1)
$split3 = StringSplit($aCoords[$iXc2 - 2][$iYc], ',', 1)
If $split17[1] <> $split2[1] Then
$aCoords[$iXc][$iYc] = 0
$aCoords[$iXc + 1][$iYc] = 777777
$aCoords[$iXc2 - 1][$iYc] = 0
If $split3[1] = $split17[1] Then
$aCoords[$iXc2 - 2][$iYc] = 777777
$iXc = $iXc2
ExitLoop
EndIf
$iXc = $iXc2
ExitLoop
EndIf
EndIf
Next
EndIf
EndIf
$count = 0
Next
Next
_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 777777 Then
For $iYc2 = $iYc To $iY - 1
If $aCoords[$iXc][$iYc2] = 0 Then
If $aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2) - 1)] = 777777 Then
$aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2) - 1)] = 777777
$iYc = $iYc2
ExitLoop
Else
$aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2) - 1)] = 111111 ; eher rechts ausgerichtet
$iYc = $iYc2
ExitLoop
EndIf
EndIf
Next
EndIf
Next
Next
For $iYc = 0 To $iY - 1
For $iXc = 0 To $iX - 1
If $aCoords[$iXc][$iYc] = 777777 Then
For $iXc2 = $iXc To $iX - 1
If $aCoords[$iXc2][$iYc] = 0 Then
If $aCoords[($iXc - 1) + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 777777 Then
$aCoords[($iXc - 1) + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 777777
$iXc = $iXc2
ExitLoop
Else
$aCoords[($iXc - 1) + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 222222 ; eher rechts ausgerichtet
$iXc = $iXc2
ExitLoop
EndIf
EndIf
Next
EndIf
Next
Next
_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 777777 Or $aCoords[$iXc][$iYc] = 999999 Then
$aCoords[$iXc][$iYc] = 0
Else
;$aCoords[$iXc][$iYc] = 888888
EndIf
Next
Next
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 111111 Then
For $iYc2 = $iYc To $iY - 1
If $aCoords[$iXc][$iYc2] = 0 Then
$aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2))] = 111111
$iYc = $iYc2
ExitLoop
ElseIf $aCoords[$iXc][$iYc2] = 111111 Then
$aCoords[$iXc][$iYc2] = 0
EndIf
Next
EndIf
Next
Next
For $iYc = 0 To $iY - 1
For $iXc = 0 To $iX - 1
If $aCoords[$iXc][$iYc] = 111111 Then
For $iXc2 = $iXc To $iX - 1
If $aCoords[$iXc2][$iYc] = 0 Then
$aCoords[$iXc + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 111111
$iXc = $iXc2
ExitLoop
ElseIf $aCoords[$iXc2][$iYc] = 111111 Then
$aCoords[$iXc2][$iYc] = 0
EndIf
Next
EndIf
Next
Next
_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 111111 Then
FileWrite($File, $iXc & "," & $iYc & @CRLF)
EndIf
Next
Next
Dim $aRec
If Not _FileReadToArray(@ScriptDir & "\cRand.txt", $aRec) Then
MsgBox(4096, "Fehler", "Fehler beim Einlesen der Datei in das Array!" & @CRLF & "Fehlercode: " & @error)
Exit
EndIf
For $x = 1 To $aRec[0]
$split = StringSplit($aRec[$x], ',', 1)
$aCoords[$split[1]][$split[2]] = 999999
;MsgBox(0, 'Datensatz ' & $x & ':', $aRec[$x])
Next
_ArrayDisplay($aCoords, Default, Default, 1)
FileClose($File)
EndFunc ;==>_Main
; Gibt eine Zeile im Memo-Fenster aus
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; _GDIPlus_GetPixel
Func _GDIPlus_GetPixel($hBitmap, $x, $Y)
Local $result = DllCall($ghGDIPDLL, "int", "GdipBitmapGetPixel", "ptr", $hBitmap, "int", $x, "int", $Y, "dword*", 0)
If @error Then Return SetError(1, 0, 0)
Return SetError($result[0], 1, $result[4])
EndFunc ;==>_GDIPlus_GetPixel
;SetPixel
Func SetPixel($oForm, $x, $Y, $color)
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", $oForm)
$setpixel = DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $Y, "long", $color)
$realesedc = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])
EndFunc ;==>SetPixel
Hier ein früheres "Werk":
#include <File.au3>
#include <Array.au3>
$count = 0
$count = 0
$count2 = 0
$double = 0
$start = 0
$cDifferences = 0
$cYzush = 0
$cut = 0
$cONE = 0
$cTWO = 0
Local $a1, $b1, $a2, $b2, $c1, $c2, $c3, $newLine, $akt, $aXY, $mR, $sX, $sY, $look, $Set
Local $aNxy[1][8]
Local $cC[1][2]
Opt('MouseClickDownDelay', 1)
Opt('MouseClickDelay', 1)
;Koordinaten in Array lesen
If Not _FileReadToArray(@ScriptDir & '\coords.txt', $aXY) Then
Dim $nofile = 0
MsgBox(4096, "Fehler", "Keine Koordinaten vorhanden. error:" & @error)
ElseIf _FileReadToArray(@ScriptDir & '\coords.txt', $aXY) Then
$nofile = 1
EndIf
If Not _FileCreate(@ScriptDir & '\midCoords.txt') Then
MsgBox(4096, "Fehler", "Fehler beim Erstellen/Zurücksetzen der txt.-Datei: " & @error)
EndIf
;Ausgabedatei
$fNewCoords = FileOpen(@ScriptDir & '\midCoords.txt', 9)
If $fNewCoords = -1 Then
MsgBox(0, "Fehler", "Die Datei konnte nicht geöffnet werden.")
Exit
EndIf
Local $aCoords[($aXY[0] + 1)][7]
$aNxy[0][0] = 'Nr.'
$aNxy[0][1] = 'x'
$aNxy[0][2] = 'y'
$aNxy[0][3] = 'Times'
$aNxy[0][4] = '1st X,y'
$aNxy[0][5] = 'mid x'
$aNxy[0][6] = 'last x,y'
$aNxy[0][7] = 'mid-y'
$aCoords[0][0] = 'Nr.'
$aCoords[0][1] = 'x'
$aCoords[0][2] = 'y'
$aCoords[0][3] = 'Times'
$aCoords[0][4] = 'cDiff'
$aCoords[0][5] = 'Y-zus'
$aCoords[0][6] = 'Y-Punkt' ; Punkt auf Strich
For $n = 1 To $aXY[0]
ReDim $cC[UBound($cC) + 1][2]
$split = StringSplit($aXY[$n], ',', 1)
$cC[$n][0] = $split[1]
$cC[$n][1] = $split[2]
;Wenn nebenliegendes Y auch vorhanden
If $split[2] - 1 = $cC[$n - 1][1] Then
$cYzush = $cYzush + 1
Else
$cYzush = 0
EndIf
If $n - 1 = 0 Then
$aCoords[$n][0] = $n
$aCoords[$n][1] = $split[1]
$aCoords[$n][2] = $split[2]
$aCoords[$n][3] = 1
$aCoords[$n][4] = $cDifferences
$aCoords[$n][6] = 1
$count = $count + 1
Else
If $split[1] = $aCoords[($n - 1)][1] Then
$count = $count + 1
$aCoords[$n][0] = $n
$aCoords[$n][1] = $split[1]
$aCoords[$n][2] = $split[2]
$aCoords[$n][3] = $count
$aCoords[$n - 1][4] = $cDifferences + 1
;$aCoords[$n][5] = $YConn ;Y-conn
$sXold = $aCoords[$n][1]
$sYold = $aCoords[$n][2]
If $count = 2 Then
$aCoords[$n][6] = 1
EndIf
ElseIf $split[1] <> $aCoords[($n - 1)][1] And $n > 1 Then
$cDifferences = $cDifferences + 1
$aCoords[$n][0] = $n ;Stelle
$aCoords[$n][1] = $split[1] ;X Coord
$aCoords[$n][2] = $split[2] ;Y Coord
$aCoords[$n][3] = 1 ;x n-mal
$aCoords[$n - 1][4] = $cDifferences ;diff n-mal
;$aCoords[$n][5] = $YConn ;Y-conn
$aCoords[$n - 2][6] = 1
ReDim $aNxy[UBound($aNxy) + 1][8]
$aNxy[0][0] = 'Nr.'
$aNxy[0][1] = 'M-x'
$aNxy[0][2] = 'M-y'
$aNxy[0][3] = 'Times'
$aNxy[0][4] = '1st X,y'
$aNxy[0][5] = 'mid x,y'
$aNxy[0][6] = 'last x,y'
$aNxy[0][7] = 'mid-y'
;Declare X-diff Array
$aNxy[$cDifferences][0] = $cDifferences ;Stelle
$aNxy[$cDifferences][3] = $count ;Times
$aNxy[$cDifferences][4] = $aXY[$n - $count] ;1st X,y
$aNxy[$cDifferences][5] = $aXY[$n - Ceiling($count / 2)] ;mid X,y
$aNxy[$cDifferences][6] = $aXY[$n - 1] ;last X,y
$count = 1
EndIf
If $split[1] = $aCoords[($n - 1)][1] And $split[2] <> ($aCoords[($n - 1)][1] + 2) And $count > 2 And $aCoords[$n][6] = 1 Then
$aCoords[$n - 2][6] = 1
EndIf
EndIf
;Wenn 2 Y nebeneinander
If $cYzush >= 2 Then
$YConn = 1
Else
$YConn = 0
EndIf
If $cYzush = 0 Then
$aCoords[$n - 1][5] = $YConn ;Y-conn
EndIf
;Wenn Y mehr/gleich 2 nebeneinanderliegende
If $YConn = 0 Then
$aNxy[$cDifferences][7] = 1 ;Y verbunden
Else
$aCoords[$n - 1][5] = $YConn ;Y-conn
$aNxy[$cDifferences][7] = 0 ;Y getrennt
EndIf
$aCoords[$n][5] = $YConn ;Y-conn
If $aCoords[$n][2] = ($aCoords[$n - 1][2] + 1) And $n > 2 Then
$cXzush = 1
Else
$cXzush = 0
EndIf
If $aCoords[$n][5] = 1 And $aCoords[$n - 1][5] = 0 Then
$start = $aCoords[$n - 1][0]
EndIf
If $aCoords[$n][5] = 0 And $aCoords[$n - 1][5] = 1 Then
$end = $aCoords[$n][0]
$mid = Ceiling(Round(($end - $start) / 2))
$aCoords[$n - $mid][6] = 1
EndIf
If $aCoords[$n][1] = $aCoords[$n - 1][1] And $aCoords[$n][2] <> ($aCoords[$n - 1][2] + 1) Then
$cutA = $aCoords[$n][0]
$aCoords[$n - 2][6] = 1
EndIf
Next
For $n = 1 To $aXY[0]
If $aCoords[$n][1] = $aCoords[$n - 1][1] And $aCoords[$n][2] <> ($aCoords[$n - 1][2] + 1) Then
$newLine = 1
EndIf
If $aCoords[$n][1] <> $aCoords[$n - 1][1] Or $aCoords[$n][2] <> ($aCoords[$n - 1][2] + 1) Then
$newLine = 0
$set = 0
EndIf
Next
For $n = 1 To $aXY[0]
If $aCoords[$n][6] = 1 And $aCoords[$n][5] = 1 And $akt = 0 Then
$start = $aCoords[$n - 1][0]
;ConsoleWrite($start & ',')
$akt = 1
EndIf
If $aCoords[$n][1] <> $aCoords[$n - 1][1] Or $aCoords[$n][4] <> $aCoords[$n - 1][4] Then
$end = $aCoords[$n][0]
$akt = 0
EndIf
If $aCoords[$n][5] = 0 And $akt = 1 Then
$end = $aCoords[$n][0]
$mid = Ceiling(Round((($end - $start) / 2)))
$a = $aCoords[$n][0]
If $aCoords[$end][3] > 4 Then
If $set = 0 Then
$aCoords[$n - $mid][6] = 2
$a = $aCoords[$n - $mid][0]
$set = 1
EndIf
If $set = 1 And $a <> $aCoords[$n - $mid][0] Then
$aCoords[$n - $mid][6] = 3
$set = 2
EndIf
Else
$aCoords[$n - $mid][6] = 1
EndIf
$akt = 0
EndIf
If $aCoords[$n][2] <> ($aCoords[$n - 1][2] + 1) Then
$set = 0
EndIf
Next
For $n = 1 To $aXY[0]
If $aCoords[$n][6] = 2 And $cTWO = 1 Then
$aCoords[$n][6] = 3
$cTWO = 0
EndIf
If $aCoords[$n][6] = 1 Then
$cTWO = 0
EndIf
If $aCoords[$n][6] = 2 Then
$cTWO = 1
EndIf
If $aCoords[$n - 1][6] = 1 And $aCoords[$n][6] = 1 Then
$aCoords[$n - 1][6] = ''
EndIf
Next
_ArrayDisplay($aCoords)
;_ArrayDisplay($aNxy)
For $i = 1 To UBound($aNxy) - 1
FileWrite($fNewCoords, $aNxy[$i][5] & @CRLF)
Next
;_1_ende
;~ $pNotepad = Run(@WindowsDir & "\Notepad.exe")
;~ $hNP = WinGetHandle($pNotepad)
;~ WinWait($hNP)
;~ $NPSize = WinGetPos($hNP)
;~ $pX = $NPSize[0] + 150
;~ $pY = $NPSize[1] + 150
;~ If $nofile = 1 Then
;~ For $x = 1 To $aXY[0]
;~ $datasplit = StringSplit($aXY[$x], ',', 1)
;~ MouseMove(($datasplit[1] + $pX), ($datasplit[2] + $pY), 1)
;~ MouseDown('left')
;~ Sleep(1)
;~ If $datasplit[1] <> $oldXcoord Then
;~ MouseUp('left')
;~ EndIf
;~ If $datasplit[2] <> $oldYcoord + 1 Then
;~ MouseUp('left')
;~ EndIf
;~ Next
;~ EndIf
;~ MouseUp('left')
Hallo,
ich bin leider noch nicht wirklich weiter. Also ich versuche immer noch die im Array als 999999 markierten Einträge so abzuarbeiten das jeweils die mitte gefunden wird.
Er soll wenn er auf der Y Achse ein 999999 gefunden hat weiterzählen bis 0 kommt. Dann die Anzahl halbieren und von dort aus die X Achse durchlaufen und die Mitte mit 777777 setzen sodass der Wert 777777 in der Mitte von der X und Y Achse liegt!!
Die Randzählung soll 2 Pixel sein.
Als Ergebnis hab ich dann die Nullinie des Types...aber es funzt nicht!! Wer kann helfen??
Edit:
[autoit#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <Array.au3>
Opt('MustDeclareVars', 1)
Local $hBitmap, $hImage, $sImageType, $iX, $iY, $iXc, $iYc, $iMemo, $iPixelColor, $count, $File, $color1, $oForm, $color, $dc, $setpixel, $realesedc
Local $hGraphic, $hBitmap, $hBackbuffer, $save, $hPen, $hWind, $cPix, $line, $split, $fRand
Local $midY[1]
Local $midX[1]
Local $found[1]
$File = FileOpen(@ScriptDir & "\coords.txt", 2)
$fRand = FileOpen(@ScriptDir & "\cRand.txt", 2)
_Main()
Func _Main()
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\PicA.jpg')
$sImageType = _GDIPlus_EncodersGetCLSID("JPG")
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
Local $aCoords[$iX][$iY]
$oForm = GUICreate("GDI+", ($iX), ($iY))
GUISetBkColor(0xFFFFFF)
GUISetState()
$hWind = WinGetHandle($oForm)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWind)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
$iPixelColor = Hex(_GDIPlus_GetPixel($hImage, $iXc, $iYc), 6)
If Dec($iPixelColor) < Dec('999999') Then
;$count = $count + 1
;FileWrite($File, $iXc & "," & $iYc & @CRLF)
$aCoords[$iXc][$iYc] = 999999
SetPixel($oForm, $iXc, $iYc, $color)
$hPen = _GDIPlus_PenCreate(0xFF000000);
_GDIPlus_GraphicsDrawLine($hBackbuffer, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
Else
$aCoords[$iXc][$iYc] = 0
EndIf
Next
Next
;$save = _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & '\Image1.jpg')
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;FileClose($File)
_GDIPlus_Shutdown()
;_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 999999 Then
If $aCoords[$iXc - 1][$iYc] = 0 Or $aCoords[$iXc + 1][$iYc] = 0 Or $aCoords[$iXc][$iYc - 1] = 0 Or $aCoords[$iXc][$iYc + 1] = 0 Then
$aCoords[$iXc][$iYc] = 777777
FileWrite($fRand, $iXc & "," & $iYc & @CRLF)
EndIf
EndIf
Next
Next
FileClose($fRand)
_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 777777 Then
For $iYc2 = $iYc To $iY - 1
If $aCoords[$iXc][$iYc2] = 0 Then
If $aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2) - 1)] = 777777 Then
$aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2) - 1)] = 777777
$iYc = $iYc2
ExitLoop
Else
$aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2) - 1)] = 111111 ; eher rechts ausgerichtet
$iYc = $iYc2
ExitLoop
EndIf
EndIf
Next
EndIf
Next
Next
For $iYc = 0 To $iY - 1
For $iXc = 0 To $iX - 1
If $aCoords[$iXc][$iYc] = 777777 Then
For $iXc2 = $iXc To $iX - 1
If $aCoords[$iXc2][$iYc] = 0 Then
If $aCoords[($iXc - 1) + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 777777 Then
$aCoords[($iXc - 1) + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 777777
$iXc = $iXc2
ExitLoop
Else
$aCoords[($iXc - 1) + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 111111 ; eher rechts ausgerichtet
$iXc = $iXc2
ExitLoop
EndIf
EndIf
Next
EndIf
Next
Next
;_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 777777 Or $aCoords[$iXc][$iYc] = 999999 Then
$aCoords[$iXc][$iYc] = 0
Else
;$aCoords[$iXc][$iYc] = 888888
EndIf
Next
Next
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 111111 Then
For $iYc2 = $iYc To $iY - 1
If $aCoords[$iXc][$iYc2] = 0 Then
$aCoords[$iXc][$iYc + Ceiling(Round(($iYc2 - $iYc) / 2))] = 111111
$iYc = $iYc2
ExitLoop
ElseIf $aCoords[$iXc][$iYc2] = 111111 Then
$aCoords[$iXc][$iYc2] = 0
EndIf
Next
EndIf
Next
Next
For $iYc = 0 To $iY - 1
For $iXc = 0 To $iX - 1
If $aCoords[$iXc][$iYc] = 111111 Then
For $iXc2 = $iXc To $iX - 1
If $aCoords[$iXc2][$iYc] = 0 Then
$aCoords[$iXc + Ceiling(Round(($iXc2 - $iXc) / 2))][$iYc] = 111111
$iXc = $iXc2
ExitLoop
ElseIf $aCoords[$iXc2][$iYc] = 111111 Then
$aCoords[$iXc2][$iYc] = 0
EndIf
Next
EndIf
Next
Next
;_ArrayDisplay($aCoords, Default, Default, 1)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 111111 Then
FileWrite($File, $iXc & "," & $iYc & @CRLF)
EndIf
Next
Next
Dim $aRec
If Not _FileReadToArray(@ScriptDir & "\cRand.txt", $aRec) Then
MsgBox(4096, "Fehler", "Fehler beim Einlesen der Datei in das Array!" & @CRLF & "Fehlercode: " & @error)
Exit
EndIf
For $x = 1 To $aRec[0]
$split = StringSplit($aRec[$x], ',', 1)
$aCoords[$split[1]][$split[2]] = 999999
;MsgBox(0, 'Datensatz ' & $x & ':', $aRec[$x])
Next
;_ArrayDisplay($aCoords, Default, Default, 1)
FileClose($File)
EndFunc ;==>_Main
; Gibt eine Zeile im Memo-Fenster aus
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; _GDIPlus_GetPixel
Func _GDIPlus_GetPixel($hBitmap, $x, $Y)
Local $result = DllCall($ghGDIPDLL, "int", "GdipBitmapGetPixel", "ptr", $hBitmap, "int", $x, "int", $Y, "dword*", 0)
If @error Then Return SetError(1, 0, 0)
Return SetError($result[0], 1, $result[4])
EndFunc ;==>_GDIPlus_GetPixel
;SetPixel
Func SetPixel($oForm, $x, $Y, $color)
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", $oForm)
$setpixel = DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $Y, "long", $color)
$realesedc = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])
EndFunc ;==>SetPixel
[/autoit]
Kennt jemand eine Lösung, nen Ansatz?? ![]()
Hallo,
ich habe eine Grafik von der die schwarzen Bereiche in ein Array geschrieben werden!
Wenn nun mehrere Werte nebeneinander gleich sind möchte ich die Mitte als neuen Wert haben, weiss jemand nen Ansatz oder ne Lösung?
Ich werd wohl mit If & ELSE arbeiten müssen, oder?
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <Array.au3>
Opt('MustDeclareVars', 1)
Local $hBitmap, $hImage, $sImageType, $iX, $iY, $iXc, $iYc, $iMemo, $iPixelColor, $Count, $File, $color1, $oForm, $color, $dc, $setpixel, $realesedc
Local $hGraphic, $hBitmap, $hBackbuffer, $save, $hPen, $hWind
$File = FileOpen(@ScriptDir & "\coords.txt", 2)
_Main()
Func _Main()
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\Pic.jpg')
$sImageType = _GDIPlus_EncodersGetCLSID("JPG")
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
Local $aCoords[$iY][$iX]
$oForm = GUICreate("GDI+", ($iX), ($iY))
GUISetBkColor(0xFFFFFF)
GUISetState()
$hWind = WinGetHandle($oForm)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWind)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
For $iYc = 0 To $iY - 1
For $iXc = 0 To $iX - 1
$iPixelColor = Hex(_GDIPlus_GetPixel($hImage, $iXc, $iYc), 6)
If Dec($iPixelColor) < Dec('882829') Then
$Count = $Count + 1
FileWrite($File, $iXc & "," & $iYc & @CRLF)
$aCoords[$iYc][$iXc] = 999999
SetPixel($oForm, $iXc, $iYc, $color)
$hPen = _GDIPlus_PenCreate(0xFF000000);
_GDIPlus_GraphicsDrawLine($hBackbuffer, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
Else
$aCoords[$iYc][$iXc] = 0
EndIf
Next
Next
$save = _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & '\Image1.jpg')
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
FileClose($File)
_GDIPlus_Shutdown()
_ArrayDisplay($aCoords, '', -1, 0)
EndFunc ;==>_Main
; Gibt eine Zeile im Memo-Fenster aus
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; _GDIPlus_GetPixel
Func _GDIPlus_GetPixel($hBitmap, $X, $Y)
Local $result = DllCall($ghGDIPDLL, "int", "GdipBitmapGetPixel", "ptr", $hBitmap, "int", $X, "int", $Y, "dword*", 0)
If @error Then Return SetError(1, 0, 0)
Return SetError($result[0], 1, $result[4])
EndFunc ;==>_GDIPlus_GetPixel
;SetPixel
Func SetPixel($oForm, $X, $Y, $color)
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", $oForm)
$setpixel = DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $X, "long", $Y, "long", $color)
$realesedc = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])
EndFunc ;==>SetPixel
Álso das Ergebnis soll ein 1-Pixel breites A sein...
UPDATE:
Also SEuBo hat mir helfen können, jedoch ist das Ergebnis noch nicht ganz perfekt. Ich müsste das ganze Horizontal und Vertikal durchführen, sodass keine 777777er nebeneinander liegen und die Linie nicht unterbrochen ist!
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <Array.au3>
Opt('MustDeclareVars', 1)
Local $hBitmap, $hImage, $sImageType, $iX, $iY, $iXc, $iYc, $iMemo, $iPixelColor, $count, $File, $color1, $oForm, $color, $dc, $setpixel, $realesedc
Local $hGraphic, $hBitmap, $hBackbuffer, $save, $hPen, $hWind
$File = FileOpen(@ScriptDir & "\coords.txt", 2)
_Main()
Func _Main()
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\PicA.jpg')
$sImageType = _GDIPlus_EncodersGetCLSID("JPG")
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
Local $aCoords[$iY][$iX]
$oForm = GUICreate("GDI+", ($iX), ($iY))
GUISetBkColor(0xFFFFFF)
GUISetState()
$hWind = WinGetHandle($oForm)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWind)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
$iPixelColor = Hex(_GDIPlus_GetPixel($hImage, $iXc, $iYc), 6)
If Dec($iPixelColor) < Dec('882829') Then
;$count = $count + 1
FileWrite($File, $iXc & "," & $iYc & @CRLF)
$aCoords[$iYc][$iXc] = 999999
SetPixel($oForm, $iXc, $iYc, $color)
$hPen = _GDIPlus_PenCreate(0xFF000000);
_GDIPlus_GraphicsDrawLine($hBackbuffer, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
Else
$aCoords[$iYc][$iXc] = 0
EndIf
Next
Next
$save = _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & '\Image1.jpg')
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
FileClose($File)
_GDIPlus_Shutdown()
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
If $aCoords[$iXc][$iYc] = 999999 Then
For $iYc2 = $iYc To $iY - 1
If $aCoords[$iXc][$iYc2] = 0 Then
; $aCoords[$iYc][$iXc + Floor(($iXc2 - $iXc - 1) / 2)] = 777777 ; eher links ausgerichtet
$aCoords[$iXc][$iYc + Floor(($iYc2 - $iYc) / 2)] = 777777 ; eher rechts ausgerichtet
$iYc = $iYc2
ExitLoop
EndIf
Next
EndIf
Next
Next
;~ ; jede "zeile" durchgehen
;~ For $iYc = 0 To $iY - 1
;~ For $iXc = 0 To $iX - 1
;~ ; wenn schwarz "beginnt"
;~ If $aCoords[$iYc][$iXc] = 999999 Then
;~ ; gehe von dort aus ($iXc) weiter nach rechts, höchstens bis zum Ende des bildes.
;~ For $iXc2 = $iXc To $iX - 1
;~ ; Wenn jetzt wieder eine weißer pixel kommt, ist die schwarze linie vorbei.
;~ If $aCoords[$iYc][$iXc2] = 0 Then
;~ ; Jetzt nur noch den Mittelpunkt der Linie ermitteln (Linie ist $iXc2 [rechter endpunkt] - $iXc [linker startpunkt] lang)
;~ ; Davon nehmen wir die Hälfte und addieren das auf den startpunkt der linie.
;~ ; bsp: Linie geht von 5 bis 14. Linie ist also 9 px lang (=14-5). Jede hälfte ist dann 4,5 px lang.
;~ ; Die Mitte liegt dann bei 9,5 (=5+4,5). Wobei wir natürlich runden müssen.
;~ ; $aCoords[$iYc][$iXc + Floor(($iXc2 - $iXc - 1) / 2)] = 777777 ; eher links ausgerichtet
;~ $aCoords[$iYc][$iXc + Floor(($iXc2 - $iXc) / 2)] = 777777 ; eher rechts ausgerichtet
;~ $iXc = $iXc2
;~ ExitLoop
;~ EndIf
;~ Next
;~ EndIf
;~ Next
;~ Next
_ArrayDisplay($aCoords, '', -1, 0)
EndFunc ;==>_Main
; Gibt eine Zeile im Memo-Fenster aus
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; _GDIPlus_GetPixel
Func _GDIPlus_GetPixel($hBitmap, $X, $Y)
Local $result = DllCall($ghGDIPDLL, "int", "GdipBitmapGetPixel", "ptr", $hBitmap, "int", $X, "int", $Y, "dword*", 0)
If @error Then Return SetError(1, 0, 0)
Return SetError($result[0], 1, $result[4])
EndFunc ;==>_GDIPlus_GetPixel
;SetPixel
Func SetPixel($oForm, $X, $Y, $color)
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", $oForm)
$setpixel = DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $X, "long", $Y, "long", $color)
$realesedc = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])
EndFunc ;==>SetPixel
Oder das das Array vllt. ungefair so dargestellt wird wie bei "Minesweeper". Das der Wert des Array-Feldes der Anzahl der nebenliegenden schwarzen Pixel beträgt!?!
Kennt jemand so eine Formel?
Oder das man wie oben erst einmal horizontal und dann nochmal vertikal "scannt"!
;~ ; jede "zeile" durchgehen
;~ For $iYc = 0 To $iY - 1
;~ For $iXc = 0 To $iX - 1
;~ ; wenn schwarz "beginnt"
;~ If $aCoords[$iYc][$iXc] = 999999 Then
;~ ; gehe von dort aus ($iXc) weiter nach rechts, höchstens bis zum Ende des bildes.
;~ For $iXc2 = $iXc To $iX - 1
;~ ; Wenn jetzt wieder eine weißer pixel kommt, ist die schwarze linie vorbei.
;~ If $aCoords[$iYc][$iXc2] = 0 Then
;~ ; Jetzt nur noch den Mittelpunkt der Linie ermitteln (Linie ist $iXc2 [rechter endpunkt] - $iXc [linker startpunkt] lang)
;~ ; Davon nehmen wir die Hälfte und addieren das auf den startpunkt der linie.
;~ ; bsp: Linie geht von 5 bis 14. Linie ist also 9 px lang (=14-5). Jede hälfte ist dann 4,5 px lang.
;~ ; Die Mitte liegt dann bei 9,5 (=5+4,5). Wobei wir natürlich runden müssen.
;~ ; $aCoords[$iYc][$iXc + Floor(($iXc2 - $iXc - 1) / 2)] = 777777 ; eher links ausgerichtet
;~ $aCoords[$iYc][$iXc + Floor(($iXc2 - $iXc) / 2)] = 777777 ; eher rechts ausgerichtet
;~ $iXc = $iXc2
;~ ExitLoop
;~ EndIf
;~ Next
;~ EndIf
;~ Next
;~ Next
Hi!
Ich hab des $ES_CENTER schon drinne, jedoch wenn ich meine Schriftarten duchgehe sind einige höher einige tiefer...
![]()
Hallo,
ich bastel an einem Font-Tool, jedoch wie bewerkstellige ich es das die Buchstaben in den Edit-Fenstern immer mittig/zentriert dargestellt werden?
Jemand nen Tip?
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <File.au3>
#include <Array.au3>
#include <ListviewConstants.au3>
#include <RegFunc.au3>
#include <GuiComboBox.au3>
#include <ScreenCapture.au3>
#Include <GuiButton.au3>
Global $fDblClk = False
Dim $aItems[1500]
Dim $aktFontNames[1500]
Dim $Fonts[1500]
Dim $FontDatName[1500]
Dim $arrays[1500][3]
Dim $result[1000]
$abc = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'
$abcSplit = StringSplit($abc, ',', 1)
$FontList = _FileListToArray(@WindowsDir & '\Fonts', '*.ttf', 1)
;_ArrayDisplay($abcSplit)
$f = 1
$x = 1
Local $sText
If @error = 1 Then
MsgBox(0, "", "No Folders Found.")
Exit
EndIf
If @error = 4 Then
MsgBox(0, "", "No Files Found.")
Exit
EndIf
$var = _GetRegValues('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts')
;_ArrayDisplay($FontList, "$FileList")
;_ArrayDisplay($var)
#region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\schlafzimmergabi\desktop\form1_1.kxf
$Form1_1 = GUICreate("Font Tool", 550, 190, 250, 159)
$Datei = GUICtrlCreateMenu("&Datei")
$MenuItem1 = GUICtrlCreateMenuitem("Optionen" & @TAB & "", $Datei)
$MenuItem2 = GUICtrlCreateMenuitem("Exit" & @TAB & "", $Datei)
$Hilfe = GUICtrlCreateMenu("&Hilfe")
$Edit1 = GUICtrlCreateEdit("", 16, 56, 70, 70, BitOR($ES_CENTER, $ES_READONLY, $ES_WANTRETURN, $WS_BORDER, $ES_UPPERCASE), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
GUICtrlSetData($Edit1, "A")
GUICtrlSetFont($Edit1, 32, 400, 0, "font")
$Edit2 = GUICtrlCreateEdit("", 89, 56, 70, 70, BitOR($ES_CENTER, $ES_READONLY, $ES_WANTRETURN, $WS_BORDER, $ES_LOWERCASE), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
GUICtrlSetData($Edit2, "a")
GUICtrlSetFont($Edit2, 32, 400, 0, "font")
$ButtonFont = GUICtrlCreateButton(@WindowsDir & '\Fonts', 16, 6, 144, 18)
$Progress1 = GUICtrlCreateProgress(16, 130, 144, ![]()
$Combo1 = GUICtrlCreateCombo("Alle", 16, 30, 145, 25, BitOR($GUI_SS_DEFAULT_COMBO, $WS_BORDER))
;GUICtrlSetData($Combo1, "Arial|Comic Sans MS|Courier New|Lucida Sans")
$Button1 = GUICtrlCreateButton("Start", 24, 144, 57, 17)
$Button2 = GUICtrlCreateButton("Abbruch", 97, 144, 57, 17)
$listview = GUICtrlCreateListView("Nr.|Datei|Name", 175, 5, 360, 145)
$hLV_Handle = GUICtrlGetHandle($listview)
_GUICtrlListView_SetColumnWidth($listview, 0, 28)
_GUICtrlListView_SetColumnWidth($listview, 2, 215)
;$List1 = GUICtrlCreateList("", 168, 24, 137, 110, BitOR($LBS_NOTIFY,$LBS_SORT,$LBS_MULTICOLUMN,$WS_BORDER))
GUICtrlSetData($listview, "")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
GUIRegisterMsg($WM_NOTIFY, "MY_WM_NOTIFY")
For $a = 1 To UBound($var)
If StringRight($var[$a - 1][2], 3) = 'ttf' Then
;MsgBox(0, "Found", $var[$a - 1][2])
$aItems[$x] = GUICtrlCreateListViewItem($x & '|' & $var[$a - 1][2] & '|' & $var[$a - 1][0], $listview)
$arrays[$x][0] = $x
$arrays[$x][1] = $var[$a - 1][0]
$arrays[$x][2] = $var[$a - 1][2]
;_ArrayDisplay($arrays)
$FontDatName[$x] = $var[$a - 1][0]
$Fonts[$x] = $var[$a - 1][2]
$aktFontNames[$x] = GUICtrlSetData($Combo1, $var[$a - 1][0])
;MsgBox(0, "Clicked", $Fonts[$x])
$x = $x + 1
EndIf
Next
;_ArrayDisplay($arrays)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $MenuItem2
Exit
Case $ButtonFont
$fod = FileSelectFolder('Fontordner wählen', '')
GUICtrlSetData($ButtonFont, $fod)
If _GUICtrlButton_GetText($ButtonFont) = '' Then
GUICtrlSetData($ButtonFont, @WindowsDir & '\Fonts')
EndIf
_GUICtrlListView_DeleteAllItems($listview)
$FontList = _FileListToArray($fod, '*.ttf', 1)
Case $Combo1
If _GUICtrlComboBox_GetEditText($Combo1) <> 'Alle' Then
;MsgBox(0, "Clicked", _GUICtrlComboBox_GetEditText($Combo1))
$results = StringTrimRight(_GUICtrlComboBox_GetEditText($Combo1), 11)
$iIndex = _ArraySearch($arrays, _GUICtrlComboBox_GetEditText($Combo1), 0, 0, 0, 1, 1)
;MsgBox(0, "Gefunden an Stelle", $iIndex)
;MsgBox(0, "Font Name", $arrays[$iIndex][1])
$result = StringTrimRight($arrays[$iIndex][1], 11)
GUICtrlSetFont($Edit1, 32, 400, 0, $result)
GUICtrlSetFont($Edit2, 32, 400, 0, $result)
EndIf
Case $Button1
If _GUICtrlComboBox_GetEditText($Combo1) == 'Alle' Then
For $z = 1 To $x
Sleep(10)
$res = StringTrimRight($arrays[$z][1], 11)
GUICtrlSetFont($Edit1, 32, 400, 0, $res)
GUICtrlSetFont($Edit2, 32, 400, 0, $res)
GUICtrlSetData($Combo1, $arrays[$z][1])
GUICtrlSetData($Progress1, $z / $x * 100)
For $s = 1 To $abcSplit[0]
Sleep(10)
GUICtrlSetData($Edit1, $abcSplit[$s])
GUICtrlSetData($Edit2, $abcSplit[$s])
$hMenu1 = GUICtrlGetHandle($Edit1)
$hMenu2 = GUICtrlGetHandle($Edit2)
$SsTake1 = _ScreenCapture_CaptureWnd('', $hMenu1, 4, 4, 66, 66)
$SsTake2 = _ScreenCapture_CaptureWnd('', $hMenu2, 4, 4, 66, 66)
_ScreenCapture_SaveImage(@DesktopDir & '\pics\Pic_big_' & $res & '_' & $s & '.jpg', $SsTake1)
_ScreenCapture_SaveImage(@DesktopDir & '\pics\Pic_small_' & $res & '_' & $s & '.jpg', $SsTake2)
Next
$s = 1
GUICtrlSetData($Edit1, 'A')
GUICtrlSetData($Edit2, 'a')
Next
Else
$res = StringTrimRight(_GUICtrlComboBox_GetEditText($Combo1), 11)
GUICtrlSetFont($Edit1, 32, 400, 0, $res)
GUICtrlSetFont($Edit2, 32, 400, 0, $res)
For $s = 1 To $abcSplit[0]
GUICtrlSetData($Progress1, $s / $abcSplit[0]*100)
$hMenu1 = GUICtrlGetHandle($Edit1)
$hMenu2 = GUICtrlGetHandle($Edit2)
GUICtrlSetData($Edit1, $abcSplit[$s])
GUICtrlSetData($Edit2, $abcSplit[$s])
$SsTake1 = _ScreenCapture_CaptureWnd('', $hMenu1, 4, 4, 66, 66)
$SsTake2 = _ScreenCapture_CaptureWnd('', $hMenu2, 4, 4, 66, 66)
_ScreenCapture_SaveImage(@DesktopDir & '\pics\Pic_big_' & $res & '_' & $s & '.jpg', $SsTake1)
_ScreenCapture_SaveImage(@DesktopDir & '\pics\Pic_small_' & $res & '_' & $s & '.jpg', $SsTake2)
Next
$s = 1
GUICtrlSetData($Edit1, 'A')
GUICtrlSetData($Edit2, 'a')
EndIf
EndSwitch
If $fDblClk Then
$fDblClk = False
$aItem = _GUICtrlListView_GetItemTextArray($hLV_Handle)
For $i = 1 To $aItem[0]
$sText &= StringFormat("spalte[%2d] %s", $i, $aItem[$i]) & @LF
Next
;~ MsgBox(4160, "Information", 'Text von Item' & @LF & @LF & $sText)
;~ MsgBox(0, "Double Clicked", _GUICtrlListView_GetItemText($hLV_Handle, _GUICtrlListView_GetSelectedIndices($hLV_Handle)))
;~ MsgBox(0, "Clicked", $aItem[3])
;MsgBox(0, "Name", $aItem[2])
$result = StringTrimRight($aItem[3], 11)
GUICtrlSetData($Combo1, $aItem[3])
GUICtrlSetFont($Edit1, 32, 400, 0, $result)
GUICtrlSetFont($Edit2, 32, 400, 0, $result)
$sText = ''
EndIf
WEnd
; React to double clicks on ListView
Func MY_WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $wParam
Local $tNMHDR = DllStructCreate("int;int;int", $lParam)
If @error Then Return
If DllStructGetData($tNMHDR, 1) = $hLV_Handle Then
If DllStructGetData($tNMHDR, 3) = $NM_DBLCLK Then $fDblClk = True
EndIf
$tNMHDR = 0
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_NOTIFY
Hallo,
ich wollte bei gedrückter linker Maustaste ein Auswahlrechteck erzeugen welches beim loslassen
1. die Auswahl in einem neuen Fenster öffnet (vergrössert)
2. die Auswahl als Bild (.jpg) und die Koordinaten des Bilds als Textdatei speichert
naja..aber es passiert nix!
#include <Misc.au3>
#include <GDIPlus.au3>
Dim $dll = DllOpen("user32.dll")
Dim $win = _WinAPI_GetDesktopWindow()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($win)
$hPen = _GDIPlus_PenCreate()
While 1
If _IsPressed('01', $dll) Then
$mPos = MouseGetPos()
While _IsPressed('1', $dll)
Sleep(100)
If MouseGetPos() <> $mPos Then
$mPosNew = MouseGetPos()
EndIf
_GDIPlus_GraphicsDrawLine($hGraphic, $mPos[0], $mPos[0], $mPosNew[0], $mPosNew[0], $hPen) ; oben(?)
_GDIPlus_GraphicsDrawLine($hGraphic, $mPos[0], $mPos[1], $mPosNew[0], $mPosNew[1], $hPen) ; unten(?)
_GDIPlus_GraphicsDrawLine($hGraphic, $mPos[1], $mPos[1], $mPosNew[1], $mPosNew[1], $hPen) ; links(?)
_GDIPlus_GraphicsDrawLine($hGraphic, $mPos[1], $mPos[0], $mPosNew[1], $mPosNew[0], $hPen) ; rechts(?)
WEnd
[/autoit] [autoit][/autoit] [autoit]; Auswahlpic speichern mit coords
[/autoit] [autoit][/autoit] [autoit]EndIf
WEnd
DllClose($dll)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
OK, danke Euch!
So siehts nun aus! Prima:
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)
Local $hBitmap, $hImage, $sImageType, $iX, $iY, $iXc, $iYc, $iMemo, $iPixelColor, $Count, $File, $color1, $oForm, $color, $dc, $setpixel, $realesedc
Local $hGraphic, $hBitmap, $hBackbuffer, $save, $hPen, $hWind
$color1 = 0x000000
$File = FileOpen(@DesktopDir & "\coords.txt", 2)
_Main()
Func _Main()
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\jdriscoll.jpg")
$sImageType = _GDIPlus_EncodersGetCLSID("JPG")
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
$oForm = GUICreate("GDI+", ($iX), ($iY))
GUISetBkColor(0xFFFFFF)
;$iMemo = GUICtrlCreateEdit("", 0, 0, ($iX + 25), ($iY + 25))
GUISetState()
$hWind = WinGetHandle($oForm)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWind)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsClear($hBackbuffer, 0xFFFFFFFF)
;PixelCount
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
$iPixelColor = Hex(_GDIPlus_GetPixel($hImage, $iXc, $iYc), 6)
If Dec($iPixelColor) < 3947582 Then
$Count = $Count + 1
FileWrite($File, $iXc & "," & $iYc & @CRLF)
;MemoWrite("X= " & $iXc & " / Y= " & $iYc)
SetPixel($oForm, $iXc, $iYc, $color)
$hPen = _GDIPlus_PenCreate(0xFF000000);
_GDIPlus_GraphicsDrawLine ($hBackbuffer, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
_GDIPlus_GraphicsDrawLine ($hGraphic, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
EndIf
Next
Next
$save = _GDIPlus_ImageSaveToFile($hBitmap,@ScriptDir & '\Image1.jpg')
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
FileClose($File)
_GDIPlus_Shutdown()
EndFunc ;==>_Main
; Gibt eine Zeile im Memo-Fenster aus
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; _GDIPlus_GetPixel
Func _GDIPlus_GetPixel($hBitmap, $X, $Y)
Local $result = DllCall($ghGDIPDLL, "int", "GdipBitmapGetPixel", "ptr", $hBitmap, "int", $X, "int", $Y, "dword*", 0)
If @error Then Return SetError(1, 0, 0)
Return SetError($result[0], 1, $result[4])
EndFunc ;==>_GDIPlus_GetPixel
;SetPixel
Func SetPixel($oForm, $X, $Y, $color)
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", $oForm)
$setpixel = DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $X, "long", $Y, "long", $color)
$realesedc = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])
EndFunc ;==>SetPixel
Hallo,
kann mir jemand sagen wieso ich nur ein schwarzes Bild als Resultat bekomme?
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)
Local $hBitmap, $hImage, $sImageType, $iX, $iY, $iXc, $iYc, $iMemo, $iPixelColor, $Count, $File, $color1, $oForm, $color, $dc, $setpixel, $realesedc
Local $hGraphic, $hBitmap, $hBackbuffer, $save, $hPen, $hWind
$color1 = 0x000000
$File = FileOpen(@DesktopDir & "\coords.txt", 2)
_Main()
Func _Main()
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\jdriscoll.jpg")
$sImageType = _GDIPlus_EncodersGetCLSID("JPG")
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
$oForm = GUICreate("GDI+", ($iX), ($iY))
GUISetBkColor(0xFFFFFF)
;$iMemo = GUICtrlCreateEdit("", 0, 0, ($iX + 25), ($iY + 25))
GUISetState()
$hWind = WinGetHandle($oForm)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWind)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;PixelCount
For $iXc = 0 To $iX - 1
For $iYc = 0 To $iY - 1
$iPixelColor = Hex(_GDIPlus_GetPixel($hImage, $iXc, $iYc), 6)
If Dec($iPixelColor) < 3947582 Then
$Count = $Count + 1
FileWrite($File, $iXc & "," & $iYc & @CRLF)
;MemoWrite("X= " & $iXc & " / Y= " & $iYc)
SetPixel($oForm, $iXc, $iYc, $color)
$hPen = _GDIPlus_PenCreate(0x000000);
_GDIPlus_GraphicsDrawLine ($hBackbuffer, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
_GDIPlus_GraphicsDrawLine ($hGraphic, $iXc, $iYc, $iXc + 1, $iYc + 1, $hPen)
EndIf
Next
Next
$save = _GDIPlus_ImageSaveToFile($hBitmap,@ScriptDir & '\Image1.jpg')
[/autoit] [autoit][/autoit] [autoit]Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
FileClose($File)
_GDIPlus_Shutdown()
EndFunc ;==>_Main
; Gibt eine Zeile im Memo-Fenster aus
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; _GDIPlus_GetPixel
Func _GDIPlus_GetPixel($hBitmap, $X, $Y)
Local $result = DllCall($ghGDIPDLL, "int", "GdipBitmapGetPixel", "ptr", $hBitmap, "int", $X, "int", $Y, "dword*", 0)
If @error Then Return SetError(1, 0, 0)
Return SetError($result[0], 1, $result[4])
EndFunc ;==>_GDIPlus_GetPixel
;SetPixel
Func SetPixel($oForm, $X, $Y, $color)
$dc = DllCall("user32.dll", "int", "GetDC", "hwnd", $oForm)
$setpixel = DllCall("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $X, "long", $Y, "long", $color)
$realesedc = DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0])
EndFunc ;==>SetPixel
Keiner der sich erbarmen möchte? ![]()
Hallo,
ich bastel immer noch an meiner Lupenfunktion! Jedoch bekomme ich die Auswahl von der Auswahl nicht berechnet, also für das Auswahlrechteck habe ich die richtigen Koordinaten, jedoch aber nicht für die erweiterte Auswahl die ich mit den Slidern bestimmen kann. Es geht Hauptsächlich um die
$AuswAuswColMitte
Variable!!
In Zeile 332 zu finden!
Kann mir da jemand helfen, bitte?
Für weitere Verbesserungen oder Vorschläge wäre ich auch sehr dankbar! Bin leider kein Programmierer, nur Autodidakt, wllt. erbarmt sich ja jemand mein Script zu überarbeiten!
Danke!
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <GuiSlider.au3>
#include <GUIConstantsEx.au3>
#include <IE.au3>
#include <Misc.au3>
#include <ScreenCapture.au3>
#include <SliderConstants.au3>
#include <Timers.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiMenu.au3>
#include <ListViewConstants.au3>
;declare
Dim $Pos
Dim $msg[5]
Dim $PosOld[2]
Dim $aPosOld[2]
Dim $PosSlOld[4]
Dim $FileLines
Dim $List
Dim $pMGr = 10
Dim $Haus[255][10]
Dim $dll = DllOpen("user32.dll")
Local $iX, $iY, $iW, $iH, $Lupe, $copyLupe, $LupeGUI, $hChild, $hWnd_Desktop, $menu1, $winLupeState, $menuMode, $auswPixCksm
Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo, $hDC_Dest, $hDC_Source, $backbuffer, $X2, $Y2, $X, $Y, $AuswAuswColMitte
Local $Sl1ScaleMin, $Sl1ScaleMax, $Sl2ScaleMin, $Sl2ScaleMax, $SliderObenPos, $SliderUntenPos, $SliderLinksPos, $SliderRechtsPos
Global $doc, $Anmelden, $oIE, $loggedin, $WinStat, $FaceStat, $maxi, $run, $menuopen, $fileopen, $save, $AuswColMitte, $AuswChksm, $hIE
Local $menu1, $n1, $bErst, $bHinz, $bBearb, $msg, $menustate, $menutext, $hinz, $countl, $num, $Pos, $MausCol, $oInputs, $oForm
Local $oPass, $oUser, $oDiv, $count, $datfile, $DatenGUI, $handle, $datasplit, $mill, $face, $menuexit, $savdat
$Scale = 10
$Sl1ScaleMin = 0
$Sl1ScaleMax = @DesktopWidth
$Sl2ScaleMin = 0
$Sl2ScaleMax = @DesktopHeight
$dist = 96
$Border = 4
$PixelDat = 4
$Pos = MouseGetPos()
HotKeySet("{ESC}", "Beenden")
;Opt('MustDeclareVars', 1)
Opt("MouseClickDelay", 250)
Opt("GUIOnEventMode", 1)
;GUI
$LupeGUI = GUICreate("Main", 275, 600, -1, -1, $WS_MINIMIZEBOX + $WS_EX_LAYERED, $WS_EX_TOPMOST);$WS_MINIMIZEBOX + $WS_EX_LAYERED + $WS_SIZEBOX + $WS_SYSMENU, $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, 'Beenden')
$menu1 = GUICtrlCreateMenu("File")
$menuData = GUICtrlCreateMenuItem("Daten", $menu1)
GUICtrlSetOnEvent($menuData, 'Beenden')
$menuexit = GUICtrlCreateMenuItem("Beenden", $menu1)
GUICtrlSetOnEvent($menuexit, 'Beenden')
$menu2 = GUICtrlCreateMenu('Einstellungen')
$menuVoreinstl = GUICtrlCreateMenu('Voreinstellungen', $menu2, 1)
$menuVoreinstlLaden = GUICtrlCreateMenuItem('Voreinstellungen laden', $menuVoreinstl)
$menuVoreinstlBearb = GUICtrlCreateMenuItem('Voreinstellungen bearbeiten', $menuVoreinstl)
$menuEinst = GUICtrlCreateMenuItem('Einstellungen', $menu2)
$menu4 = GUICtrlCreateMenu('User')
$mHaus = GUICtrlCreateMenuItem('Häuserdaten', $menu4)
$mLaden = GUICtrlCreateMenuItem('Geschäftsdaten', $menu4)
$mUser = GUICtrlCreateMenuItem('User', $menu4)
;~ GUICtrlSetOnEvent($mLaden, 'speichernunter')
;~ GUICtrlSetOnEvent($mHaus, 'speichernunter')
;~ GUICtrlSetOnEvent($mUser, 'speichernunter')
$SliderOben = GUICtrlCreateSlider(20, 0, 218, 32, 0, $TBS_NOTICKS)
$SliderUnten = GUICtrlCreateSlider(20, 226, 218, 32, BitOR($TBS_TOP, $TBS_LEFT, $TBS_NOTICKS))
$SliderLinks = GUICtrlCreateSlider(5, 17, 32, 218, $TBS_VERT, $TBS_NOTICKS)
$SliderRechts = GUICtrlCreateSlider(230, 17, 34, 218, BitOR($TBS_VERT, $TBS_NOTICKS, $TBS_TOP, $TBS_LEFT))
$Input1 = GUICtrlCreateInput("", 4, 440, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input2 = GUICtrlCreateInput("", 4, 460, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input3 = GUICtrlCreateInput("", 4, 480, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input5 = GUICtrlCreateInput("", 80, 280, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input6 = GUICtrlCreateInput("", 80, 295, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input7 = GUICtrlCreateInput("", 4, 335, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input8 = GUICtrlCreateInput("", 4, 355, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input9 = GUICtrlCreateInput("", 137, 440, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input10 = GUICtrlCreateInput("", 137, 460, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input11 = GUICtrlCreateInput("", 137, 480, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input12 = GUICtrlCreateInput("", 4, 380, 200, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input13 = GUICtrlCreateInput("", 4, 400, 200, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input14 = GUICtrlCreateInput("", 137, 500, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Label1 = GUICtrlCreateLabel("Koordinaten:", 8, 423, 64, 17)
$Label2 = GUICtrlCreateLabel(' x - Achse = ', 20, 280, 48, 17)
$Label3 = GUICtrlCreateLabel(' y - Achse = ', 20, 295, 48, 17)
$Label5 = GUICtrlCreateLabel('Auswahl', 25, 319, 65, 15, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Label6 = GUICtrlCreateLabel('Lupe', 20, 262, 65, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Label7 = GUICtrlCreateLabel("Farbwerte:", 140, 423, 64, 17)
GUICtrlSetFont($Label1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetFont($Label7, 8, 400, 4, "MS Sans Serif")
GUICtrlSetFont($Label5, 9, 800, 4, "MS Sans Serif")
GUICtrlSetFont($Label6, 9, 800, 4, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox(' fixieren (ALT + 1)', 137, 280, 130, 17, BitOR($BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE, $BS_FLAT, $WS_TABSTOP, $WS_CLIPSIBLINGS), $WS_EX_STATICEDGE)
$Checkbox2 = GUICtrlCreateCheckbox(' Modi Switch (ALT + 2)', 137, 297, 130, 17, BitOR($BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE, $BS_FLAT, $WS_TABSTOP, $WS_CLIPSIBLINGS), $WS_EX_STATICEDGE)
$Checkbox3 = GUICtrlCreateCheckbox(' + Pic save (ALT + 3)', 137, 314, 130, 17, BitOR($BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE, $BS_FLAT, $WS_TABSTOP, $WS_CLIPSIBLINGS), $WS_EX_STATICEDGE)
$Button1 = GUICtrlCreateButton(" A ", 157, 337, 90, 20, BitOR($BS_CENTER, $WS_GROUP, $WS_BORDER))
$Button2 = GUICtrlCreateButton(" B ", 157, 359, 90, 20, BitOR($BS_CENTER, $WS_GROUP, $WS_BORDER))
GUICtrlSetOnEvent($Button1, 'Beenden')
GUICtrlSetOnEvent($Button2, 'Beenden')
$hPen = _GDIPlus_PenCreate()
;GUICtrlSetResizing ($LupeGUI, $GUI_DOCKAUTO)
GUISetState(@SW_SHOW, $LupeGUI)
GUICtrlSetLimit($SliderOben, ($dist * 2), 0)
GUICtrlSetData($SliderOben, 45)
GUICtrlSetLimit($SliderUnten, ($dist * 2), 0)
GUICtrlSetData($SliderUnten, 80)
GUICtrlSetLimit($SliderLinks, ($dist * 2), 0)
GUICtrlSetData($SliderLinks, 80)
GUICtrlSetLimit($SliderRechts, ($dist * 2), 0)
GUICtrlSetData($SliderRechts, 120)
GUICtrlSetData($menu4, 'Userdaten')
$save = FileOpen(@ScriptDir & '\User.txt', 2)
$datfile = @ScriptDir & '\User.txt'
$savdat = 'Userdaten'
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
;
$hLupe = GUICreate("", ($dist / 2), ($dist / 2), $Pos[0] + ($dist / 4), $Pos[1] + ($dist / 4), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_STATICEDGE), $LupeGUI)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 0, 0, ($dist / 2), ($dist / 2)), 0xFF0000)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 2, 2, (($dist / 2) - $Border), (($dist / 2) - $Border)), 0xABCDEF)
GUISetState()
GUISwitch($LupeGUI)
;
_GDIPlus_Startup()
_WinAPI_SetLayeredWindowAttributes($hLupe, 0xABCDEF, 255)
$hWnd_Desktop = _WinAPI_GetDesktopWindow()
$hDC_Source = _WinAPI_GetDC($hWnd_Desktop)
$hDC_Dest = _WinAPI_GetDC($LupeGUI)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($LupeGUI)
WinActivate('Main')
While 1;GUIGetMsg(1) <> $GUI_EVENT_CLOSE
Sleep(10)
$Pos = MouseGetPos()
;Checkbox1 check ' fixieren'
If _IsPressed('12', $dll) And _IsPressed('31', $dll) Then
Sleep(50)
If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
ElseIf BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
EndIf
EndIf
;wenn Checkbox1 'unchecked' löse Lupe von Maus
If BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
;Mausposition abfragen
;$Pos = MouseGetPos()
; MausAuswahlposition abfragen
$aWinPos = WinGetPos($hLupe)
$iX = $aWinPos[0] ; x
$iY = $aWinPos[1] ; y
$iW = $aWinPos[2] ; width
$iH = $aWinPos[3] ; height
;InfoPost
;Input Zeilen
GUICtrlSetData($Input1, 'Maus: x = ' & $Pos[0] & ' , y = ' & $Pos[1])
GUICtrlSetData($Input2, 'Lupe: x = ' & Round($iX, 0) & ' , y = ' & Round($iY, 0))
GUICtrlSetData($Input3, 'Horiz.: ' & $countLR & ' , Vert.: ' & $countHR)
;Wenn sich Mausposition ändert
If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
WinMove($hLupe, "", $Pos[0] + ($dist / 4), $Pos[1] + ($dist / 4))
$PosOld = $Pos
$countLR = 0
$countHR = 0
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Input6, $iY + ($iH / 2))
EndIf
;Wenn Bewegungstaste gedrückt
If _IsPressed('25', $dll) And $iX > $Sl1ScaleMin Then ;links gedrückt
$countLR = $countLR + (-1)
WinMove($hLupe, "", $iX - $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('27', $dll) And ($iX + $iW) < $Sl1ScaleMax Then ;rechts gedrückt
$countLR = $countLR + 1
WinMove($hLupe, "", $iX + $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('26', $dll) And $iY > $Sl2ScaleMin Then ;hoch gedrückt
$countHR = $countHR + (-1)
WinMove($hLupe, "", $iX, $iY - $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('28', $dll) And ($iY + $iH) < $Sl2ScaleMax Then ;runter gedrückt
$countHR = $countHR + 1
WinMove($hLupe, "", $iX, $iY + $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndIf
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
If $SliderObenPos <> $PosSlOld[0] Or $SliderUntenPos <> $PosSlOld[1] Or $SliderLinksPos <> $PosSlOld[2] Or $SliderRechtsPos <> $PosSlOld[3] Then
$PosSlOld[0] = $SliderObenPos
$PosSlOld[1] = $SliderUntenPos
$PosSlOld[2] = $SliderLinksPos
$PosSlOld[3] = $SliderRechtsPos
EndIf
draw()
;wenn Checkbox1 'checked'
ElseIf BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
$WinPosSave = WinGetPos($hLupe)
$iX = $WinPosSave[0] ; x
$iY = $WinPosSave[1] ; y
$iW = $WinPosSave[2] ; width
$iH = $WinPosSave[3] ; height
draw()
EndIf
;
;Checkbox2 check ' Modi Switch'
If _IsPressed('12', $dll) And _IsPressed('32', $dll) Then
Sleep(50)
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
ElseIf BitAND(GUICtrlRead($Checkbox2), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
EndIf
EndIf
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED And $menuMode = 0 Then
$menuMode = 1
WinSetState($hLupe, '', @SW_HIDE)
GUISetState(@SW_MINIMIZE, $LupeGUI)
ToolTip('')
;maximieren()
ElseIf BitAND(GUICtrlRead($Checkbox2), $GUI_UNCHECKED) = $GUI_UNCHECKED And $menuMode = 1 Then
$menuMode = 0
WinSetState($hLupe, '', @SW_SHOW)
GUISetState(@SW_RESTORE, $LupeGUI)
ToolTip('')
EndIf
;Checkbox3 check ' + Pic Save'
If _IsPressed('12', $dll) And _IsPressed('33', $dll) Then
Sleep(50)
If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
ElseIf BitAND(GUICtrlRead($Checkbox3), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
EndIf
EndIf
If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
$PicSave = 1
ElseIf BitAND(GUICtrlRead($Checkbox3), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
$PicSave = 0
EndIf
If $menuMode = 0 And BitAND(WinGetState($LupeGUI), 2) = 2 Then
If BitAND(WinGetState($LupeGUI), 16) = 16 Then
ToolTip('')
ElseIf BitAND(WinGetState($LupeGUI), 1) = 1 Then
ToolTip((Round($aWinPos[0] + ($aWinPos[2] / 2), 0)) & ', ' & Round(($aWinPos[1] + ($aWinPos[3] / 2)), 0), $iX, $iY + $iH)
EndIf
If $SliderLinksPos > $SliderRechtsPos Then
$Ya = $SliderRechtsPos
$Yb = $SliderLinksPos
$Y = $Ya + $iY
$height = Abs($Yb - $Ya)
$Y2 = $Y + $height
Else
$Ya = $SliderLinksPos
$Yb = $SliderRechtsPos
$Y = $Ya + $iY
$height = Abs($Yb - $Ya)
$Y2 = $Y + $height
EndIf
If $SliderObenPos > $SliderUntenPos Then
$Xa = $SliderUntenPos
$Xb = $SliderObenPos
$X = $Xa + $iX
$width = Abs($Xb - $Xa)
$X2 = $X + $width
Else
$Xa = $SliderObenPos
$Xb = $SliderUntenPos
$X = $Xa + $iX
$width = Abs($Xb - $Xa)
$X2 = $X + $width
EndIf
ElseIf $menuMode = 1 Then ;ToolTip
ToolTip('Datensatz: ' & $savdat & @CRLF & 'Nr.: ' & $num + 1 & ', x=' & $Pos[0] & ' / y=' & $Pos[1] & @CRLF & 'col=' & $MausCol & @CRLF & 'MitteLupe.: ' & $AuswColMitte & @CRLF & 'MitteAusw.: ' & $AuswAuswColMitte & @CRLF & 'AuswChksm: ' & $auswPixCksm, $Pos[0] + 50, $Pos[1] - 10)
EndIf
;Fenster Animation 'Zusammenhang sichern'
If WinGetState($LupeGUI) = 16 And WinGetState($hLupe) = 2 And $winLupeState = 1 Then
$winLupeState = 0
GUISetState(@SW_HIDE, $hLupe)
WinSetState($hLupe, '', @SW_HIDE)
ElseIf WinGetState($LupeGUI) = 3 And WinGetState($hLupe) <> 2 Then
$winLupeState = 1
GUISetState(@SW_SHOW, $hLupe)
WinSetState($hLupe, '', @SW_SHOW)
EndIf
If _IsPressed('10', $dll) And _IsPressed('01', $dll) Then
;If _IsPressed('01', $dll) Then
$num = $num + 1
$Haus[$num][0] = $num ;Position
$Haus[$num][1] = $Pos[0] ;x-Pos
$Haus[$num][2] = $Pos[1] ;y-Pos
$Haus[$num][3] = $MausCol ;Mouse PixColor
$Haus[$num][4] = $AuswColMitte ;Lupe Mitte Color (!)
$Haus[$num][5] = $auswPixCksm ;Auswahl Mitte Color
;~ $Haus[$num][6] = ($iX + $X) ;x oben
;~ $Haus[$num][7] = ($iY + $Y) ;y oben
;~ $Haus[$num][8] = ($iX + $X + $w1) ;x unten
;~ $Haus[$num][9] = ($iY + $Y + $h1) ;y unten
;Bild speichern?
;~ If $PicSave = 1 Then
;~ $sDir = 'C:\Dokumente und Einstellungen\Besitzer\Desktop\' & StringFormat('%s.%s.%s\%s', @MDAY, @MON, @YEAR, $num)
;~ DirCreate($sDir)
;~ $sFile1 = $sDir & "\mColors.txt"
;~ $sFile2 = $sDir & "\aColors.txt"
;~ $hFile1 = FileOpen($sFile1, 1) ; 1 = append (anhängen)
;~ $hFile2 = FileOpen($sFile2, 1) ; 1 = append (anhängen)
;~ $hBMP = _ScreenCapture_Capture($sDir & '\Lupe.jpg', $iX, $iY, $iX + $iW, $iY + $iH)
;~ $hBMP2 = _ScreenCapture_Capture($sDir & '\Auswahl.jpg', $iX + $X - 2, $iY + $Y - 2, $iX + $X + $w1, $iY + $Y + $h1)
;~ $hBMPm = _ScreenCapture_Capture($sDir & '\Maus.jpg', $Pos[0] - $pMGr, $Pos[1] - $pMGr, $Pos[0] + $pMGr, $Pos[1] + $pMGr)
;~ _ScreenCapture_SaveImage($sDir & '\Lupe.jpg', $hBMP)
;~ _ScreenCapture_SaveImage($sDir & '\Auswahl.jpg', $hBMP2)
;~ _ScreenCapture_SaveImage($sDir & '\Maus.jpg', $hBMPm)
;~ $colors_A = _getPixelColors($Pos[0] - 10, $Pos[1] - 10, $Pos[0] + 10, $Pos[1] + 10, $hFile1)
;~ $colors_B = _getPixelColors($iX + $X, $iY + $Y, $iX + $X + $w1, $iY + $Y + $h1, $hFile2)
;~ EndIf
;Daten speichern
FileWrite($save, $Haus[$num][0] & ',' & $Haus[$num][1] & ',' & $Haus[$num][2] & ',' & $Haus[$num][3] & ',' & $Haus[$num][4] & ',' & $Haus[$num][5] & ',' & $Haus[$num][6] & ',' & $Haus[$num][7] & ',' & $Haus[$num][8] & ',' & $Haus[$num][9] & @CRLF)
Sleep(100)
;EndIf
EndIf
$MausCol = PixelGetColor($Pos[0], $Pos[1])
$AuswColMitte = PixelGetColor(Round($iX + ($iW / 2), 0), Round($iY + ($iH / 2), 0))
$AuswAuswColMitte = PixelGetColor($iX + $Xa + Abs($Xa - $Xb), $iY + $Ya + Abs($Ya - $Yb))
$auswPixCksm = PixelChecksum(($iX + $X), ($iY + $Y), ($iX + $X) + Abs($SliderLinksPos - $SliderRechtsPos), ($iY + $Y) + Abs($SliderObenPos - $SliderUntenPos)) ;Auswahlrechteck x1,y1,x2,y2
GUICtrlSetData($Input9, 'Maus: ' & PixelGetColor($Pos[0], $Pos[1]))
GUICtrlSetData($Input10, 'AuswahlMitte: ' & PixelGetColor($iX + ($iW / 2), $iY + ($iH / 2)))
GUICtrlSetData($Input11, 'AAuswMitte: ' & $AuswAuswColMitte)
GUICtrlSetData($Input14, 'AuswChksm: ' & $auswPixCksm)
GUICtrlSetData($Input7, ' x = ' & Round($iX + ($Xa / 2), 0) & ', y = ' & Round($iY + ($Ya / 2), 0))
GUICtrlSetData($Input8, 'Breite = ' & $width & ', Höhe = ' & $height)
GUICtrlSetData($Input12, 'SlOben = ' & $SliderObenPos & ', SlUnten = ' & $SliderUntenPos & ', Diff: ' & Abs($SliderObenPos - $SliderUntenPos))
GUICtrlSetData($Input13, 'SlLinks = ' & $SliderLinksPos & ', SlRechts = ' & $SliderRechtsPos & ', Diff: ' & Abs($SliderLinksPos - $SliderRechtsPos))
WEnd
Func draw()
; Bild per StretchBlt übertragen
$Lupe = _WinAPI_StretchBlt( _
$hDC_Dest, 32, 30, 192, 192, _
$hDC_Source, $iX, $iY, $iW, $iH, _
$SRCCOPY)
;Auswahl 'Auswahlslider'
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
;Auswahl zeichnen
_GDIPlus_GraphicsDrawLine($hGraphic, 32, 30 + $SliderLinksPos, 222, 30 + $SliderLinksPos, $hPen); oben
_GDIPlus_GraphicsDrawLine($hGraphic, 32, 30 + $SliderRechtsPos, 222, 30 + $SliderRechtsPos, $hPen); unten
_GDIPlus_GraphicsDrawLine($hGraphic, 32 + $SliderObenPos, 30, 32 + $SliderObenPos, 220, $hPen); links
_GDIPlus_GraphicsDrawLine($hGraphic, 32 + $SliderUntenPos, 30, 32 + $SliderUntenPos, 220, $hPen); rechts
EndFunc ;==>draw
Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop)
Local $Ret = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', $iXDest, 'int', $iYDest, 'int', $iWidthDest, 'int', $iHeightDest, 'hwnd', $hSrcDC, 'int', $iXSrc, 'int', $iYSrc, 'int', $iWidthSrc, 'int', $iHeightSrc, 'dword', $iRop)
If (@error) Or (Not IsArray($Ret)) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_StretchBlt
Func SpecialEvents()
Select
Case @GUI_CtrlId = $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_SHOW, $LupeGUI)
WinSetState($hLupe, '', @SW_SHOW)
Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
;MsgBox(0, "Fenster minimiert", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
Case @GUI_CtrlId = $GUI_EVENT_RESTORE
;MsgBox(0, "Fenster wiederhergestellt", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
EndSelect
EndFunc ;==>SpecialEvents
Func schliessen()
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_SHOW, $LupeGUI)
WinSetState($hLupe, '', @SW_SHOW)
EndFunc ;==>schliessen
Func Beenden()
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
FileClose($save)
DllClose($dll)
Exit
EndFunc ;==>Beenden
Func _getPixelColors($start_X, $start_Y, $end_X, $end_Y, $File)
Local $coord[$end_X - $start_X][$end_Y - $start_Y]
For $X = 0 To UBound($coord, 1) - 1
For $Y = 0 To UBound($coord, 2) - 1
$coord[$X][$Y] = PixelGetColor($X + $start_X, $Y + $start_Y)
FileWrite($File, $X & ',' & $Y & ',' & $coord[$X][$Y] & @CRLF)
Next
Next
Return $coord
EndFunc ;==>_getPixelColors
Hallo,
ich bräuchte mal jemand der sich bisschen Zeit für mein Script nimmt!
Ich bin kein Programmierer, oder ähnliches, deswegen würd ich gern von einem "Profi" mal die Werte in meinem Script checken lassen!
Mir erscheinen die Farbwertdaten, vorallem beim Checksum, nicht korrekt!
Für weitere Vervesserungen oder Vorschläge bin ich sehr dankbar!
#include <Array.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <GuiSlider.au3>
#include <GUIConstantsEx.au3>
#include <IE.au3>
#include <Misc.au3>
#include <ScreenCapture.au3>
#include <SliderConstants.au3>
#include <Timers.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <GuiMenu.au3>
#include <ListViewConstants.au3>
;declare
Dim $Pos
Dim $msg[5]
Dim $PosOld[2]
Dim $aPosOld[2]
Dim $PosSlOld[4]
Dim $FileLines
Dim $List
Dim $pMGr = 10
Local $iX, $iY, $iW, $iH, $Lupe, $copyLupe, $LupeGUI, $hChild, $hWnd_Desktop, $menu1, $winLupeState, $menuMode, $auswPixCksm
Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo, $hDC_Dest, $hDC_Source, $backbuffer, $X2, $Y2, $X, $Y, $AuswMitte
Local $Sl1ScaleMin, $Sl1ScaleMax, $Sl2ScaleMin, $Sl2ScaleMax, $SliderObenPos, $SliderUntenPos, $SliderLinksPos, $SliderRechtsPos
Global $doc, $Anmelden, $oIE, $loggedin, $WinStat, $FaceStat, $maxi, $run, $menuopen, $fileopen, $save, $AuswCol, $AuswChksm, $hIE
Local $menu1, $n1, $bErst, $bHinz, $bBearb, $msg, $menustate, $menutext, $hinz, $countl, $num, $Pos, $col, $oInputs, $oForm
Local $oPass, $oUser, $oDiv, $count, $datfile, $DatenGUI, $handle, $datasplit, $mill, $face, $menuexit, $savdat
Dim $Anmelden = WinExists('Anmelden')
Dim $dll = DllOpen("user32.dll")
Local $sUser = 'XXXXX'
Local $sPass = 'xxxx'
Local $url = 'www.google.de'
Local $loginurl = 'www.google.de'
Local $stateface = WinGetState('google')
Local $statemill = WinGetState('google')
Dim $Haus[255][10]
Dim $countl
$Haus[0][0] = 'Nr.'
$Haus[0][1] = 'x'
$Haus[0][2] = 'y'
$Haus[0][3] = 'col'
$Haus[0][4] = 'Ausw-M.'
$Haus[0][5] = 'AuswChksm'
$Haus[0][6] = 'x oben'
$Haus[0][7] = 'y oben'
$Haus[0][8] = 'x unten'
$Haus[0][9] = 'y unten'
$Scale = 10
$Sl1ScaleMin = 0
$Sl1ScaleMax = @DesktopWidth
$Sl2ScaleMin = 0
$Sl2ScaleMax = @DesktopHeight
$dist = 96
$Border = 4
$PixelDat = 4
$Pos = MouseGetPos()
HotKeySet("{ESC}", "Beenden")
;Opt('MustDeclareVars', 1)
Opt("MouseClickDelay", 250)
Opt("GUIOnEventMode", 1)
;GUI
$LupeGUI = GUICreate("Main", 275, 510, -1, -1, $WS_MINIMIZEBOX + $WS_EX_LAYERED, $WS_EX_TOPMOST);$WS_MINIMIZEBOX + $WS_EX_LAYERED + $WS_SIZEBOX + $WS_SYSMENU, $WS_EX_TOPMOST)
GUISetOnEvent($GUI_EVENT_CLOSE, 'Beenden')
$menu1 = GUICtrlCreateMenu("File")
$menuData = GUICtrlCreateMenuItem("Daten", $menu1)
GUICtrlSetOnEvent($menuData, 'DatenGUI')
$menuexit = GUICtrlCreateMenuItem("Beenden", $menu1)
GUICtrlSetOnEvent($menuexit, 'Beenden')
$menu2 = GUICtrlCreateMenu('Einstellungen')
$menuVoreinstl = GUICtrlCreateMenu('Voreinstellungen', $menu2, 1)
$menuVoreinstlLaden = GUICtrlCreateMenuItem('Voreinstellungen laden', $menuVoreinstl)
$menuVoreinstlBearb = GUICtrlCreateMenuItem('Voreinstellungen bearbeiten', $menuVoreinstl)
$menuEinst = GUICtrlCreateMenuItem('Einstellungen', $menu2)
$menu4 = GUICtrlCreateMenu('User')
$mHaus = GUICtrlCreateMenuItem('Häuserdaten', $menu4)
$mLaden = GUICtrlCreateMenuItem('Geschäftsdaten', $menu4)
$mUser = GUICtrlCreateMenuItem('User', $menu4)
GUICtrlSetOnEvent($mLaden, 'speichernunter')
GUICtrlSetOnEvent($mHaus, 'speichernunter')
GUICtrlSetOnEvent($mUser, 'speichernunter')
$SliderOben = GUICtrlCreateSlider(20, 0, 218, 32, 0, $TBS_NOTICKS)
$SliderUnten = GUICtrlCreateSlider(20, 226, 218, 32, BitOR($TBS_TOP, $TBS_LEFT, $TBS_NOTICKS))
$SliderLinks = GUICtrlCreateSlider(5, 17, 32, 218, $TBS_VERT, $TBS_NOTICKS)
$SliderRechts = GUICtrlCreateSlider(230, 17, 34, 218, BitOR($TBS_VERT, $TBS_NOTICKS, $TBS_TOP, $TBS_LEFT))
$Input1 = GUICtrlCreateInput("", 4, 400, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input2 = GUICtrlCreateInput("", 4, 420, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input3 = GUICtrlCreateInput("", 4, 440, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input5 = GUICtrlCreateInput("", 80, 280, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input6 = GUICtrlCreateInput("", 80, 295, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input7 = GUICtrlCreateInput("", 4, 335, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input8 = GUICtrlCreateInput("", 4, 355, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input9 = GUICtrlCreateInput("", 137, 400, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input10 = GUICtrlCreateInput("", 137, 420, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input11 = GUICtrlCreateInput("", 137, 440, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Label1 = GUICtrlCreateLabel("Koordinaten:", 8, 383, 64, 17)
$Label2 = GUICtrlCreateLabel(' x - Achse = ', 20, 280, 48, 17)
$Label3 = GUICtrlCreateLabel(' y - Achse = ', 20, 295, 48, 17)
$Label5 = GUICtrlCreateLabel('Auswahl', 25, 319, 65, 15, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Label6 = GUICtrlCreateLabel('Lupe', 20, 262, 65, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Label7 = GUICtrlCreateLabel("Farbwerte:", 140, 383, 64, 17)
GUICtrlSetFont($Label1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetFont($Label7, 8, 400, 4, "MS Sans Serif")
GUICtrlSetFont($Label5, 9, 800, 4, "MS Sans Serif")
GUICtrlSetFont($Label6, 9, 800, 4, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox(' fixieren (ALT + 1)', 137, 280, 130, 17, BitOR($BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE, $BS_FLAT, $WS_TABSTOP, $WS_CLIPSIBLINGS), $WS_EX_STATICEDGE)
$Checkbox2 = GUICtrlCreateCheckbox(' Modi Switch (ALT + 2)', 137, 297, 130, 17, BitOR($BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE, $BS_FLAT, $WS_TABSTOP, $WS_CLIPSIBLINGS), $WS_EX_STATICEDGE)
$Checkbox3 = GUICtrlCreateCheckbox(' + Pic save (ALT + 3)', 137, 314, 130, 17, BitOR($BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_RIGHTBUTTON, $BS_MULTILINE, $BS_FLAT, $WS_TABSTOP, $WS_CLIPSIBLINGS), $WS_EX_STATICEDGE)
$Button1 = GUICtrlCreateButton(" Einloggen ", 157, 337, 90, 20, BitOR($BS_CENTER, $WS_GROUP, $WS_BORDER))
$Button2 = GUICtrlCreateButton(" City maximieren ", 157, 359, 90, 20, BitOR($BS_CENTER, $WS_GROUP, $WS_BORDER))
GUICtrlSetOnEvent($Button1, 'Einloggen')
GUICtrlSetOnEvent($Button2, 'maximieren')
$hPen = _GDIPlus_PenCreate()
;GUICtrlSetResizing ($LupeGUI, $GUI_DOCKAUTO)
GUISetState(@SW_SHOW, $LupeGUI)
GUICtrlSetLimit($SliderOben, 192, 0)
GUICtrlSetData($SliderOben, 45)
GUICtrlSetLimit($SliderUnten, 192, 0)
GUICtrlSetData($SliderUnten, 80)
GUICtrlSetLimit($SliderLinks, 192, 0)
GUICtrlSetData($SliderLinks, 80)
GUICtrlSetLimit($SliderRechts, 192, 0)
GUICtrlSetData($SliderRechts, 120)
GUICtrlSetData($menu4, 'Userdaten')
$save = FileOpen(@ScriptDir & '\User.txt', 2)
$datfile = @ScriptDir & '\User.txt'
$savdat = 'Userdaten'
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
;
$hLupe = GUICreate("", ($dist / 2), ($dist / 2), $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_STATICEDGE), $LupeGUI)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 0, 0, ($dist / 2), ($dist / 2)), 0xFF0000)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 2, 2, (($dist / 2) - $Border), (($dist / 2) - $Border)), 0xABCDEF)
GUISetState()
GUISwitch($LupeGUI)
;
_GDIPlus_Startup()
_WinAPI_SetLayeredWindowAttributes($hLupe, 0xABCDEF, 255)
$hWnd_Desktop = _WinAPI_GetDesktopWindow()
$hDC_Source = _WinAPI_GetDC($hWnd_Desktop)
$hDC_Dest = _WinAPI_GetDC($LupeGUI)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($LupeGUI)
WinActivate('Main')
;DatensatzGUI()
[/autoit] [autoit][/autoit] [autoit];Schleife
While 1;GUIGetMsg(1) <> $GUI_EVENT_CLOSE
Sleep(10)
$Pos = MouseGetPos()
;Checkbox1 check ' fixieren'
If _IsPressed('12', $dll) And _IsPressed('31', $dll) Then
Sleep(50)
If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
ElseIf BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
EndIf
EndIf
;wenn Checkbox1 'unchecked' löse Lupe von Maus
If BitAND(GUICtrlRead($Checkbox1), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
;Mausposition abfragen
$Pos = MouseGetPos()
; MausAuswahlposition abfragen
$aWinPos = WinGetPos($hLupe)
$iX = $aWinPos[0] ; x
$iY = $aWinPos[1] ; y
$iW = $aWinPos[2] ; width
$iH = $aWinPos[3] ; height
;InfoPost
;Input Zeilen
GUICtrlSetData($Input1, 'Maus: x = ' & $Pos[0] & ' , y = ' & $Pos[1])
GUICtrlSetData($Input2, 'Lupe: x = ' & $aWinPos[0] & ' , y = ' & $aWinPos[1])
GUICtrlSetData($Input3, 'Horiz.: ' & $countLR & ' , Vert.: ' & $countHR)
;Wenn sich Mausposition ändert
If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
WinMove($hLupe, "", $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8))
$PosOld = $Pos
$countLR = 0
$countHR = 0
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Input6, $iY + ($iH / 2))
EndIf
;Wenn Bewegungstaste gedrückt
If _IsPressed('25', $dll) And $iX > $Sl1ScaleMin Then ;links gedrückt
$countLR = $countLR + (-1)
WinMove($hLupe, "", $iX - $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('27', $dll) And ($iX + $iW) < $Sl1ScaleMax Then ;rechts gedrückt
$countLR = $countLR + 1
WinMove($hLupe, "", $iX + $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('26', $dll) And $iY > $Sl2ScaleMin Then ;hoch gedrückt
$countHR = $countHR + (-1)
WinMove($hLupe, "", $iX, $iY - $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('28', $dll) And ($iY + $iH) < $Sl2ScaleMax Then ;runter gedrückt
$countHR = $countHR + 1
WinMove($hLupe, "", $iX, $iY + $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndIf
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
If $SliderObenPos <> $PosSlOld[0] Or $SliderUntenPos <> $PosSlOld[1] Or $SliderLinksPos <> $PosSlOld[2] Or $SliderRechtsPos <> $PosSlOld[3] Then
$PosSlOld[0] = $SliderObenPos
$PosSlOld[1] = $SliderUntenPos
$PosSlOld[2] = $SliderLinksPos
$PosSlOld[3] = $SliderRechtsPos
EndIf
draw()
;wenn Checkbox1 'checked'
ElseIf BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then
$WinPosSave = WinGetPos($hLupe)
$iX = $WinPosSave[0] ; x
$iY = $WinPosSave[1] ; y
$iW = $WinPosSave[2] ; width
$iH = $WinPosSave[3] ; height
draw()
EndIf
;
;Checkbox2 check ' Modi Switch'
If _IsPressed('12', $dll) And _IsPressed('32', $dll) Then
Sleep(50)
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
ElseIf BitAND(GUICtrlRead($Checkbox2), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
EndIf
EndIf
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) = $GUI_CHECKED And $menuMode = 0 Then
$menuMode = 1
WinSetState($hLupe, '', @SW_HIDE)
GUISetState(@SW_MINIMIZE, $LupeGUI)
ToolTip('')
;maximieren()
ElseIf BitAND(GUICtrlRead($Checkbox2), $GUI_UNCHECKED) = $GUI_UNCHECKED And $menuMode = 1 Then
$menuMode = 0
WinSetState($hLupe, '', @SW_SHOW)
GUISetState(@SW_RESTORE, $LupeGUI)
ToolTip('')
EndIf
;Checkbox3 check ' + Pic Save'
If _IsPressed('12', $dll) And _IsPressed('33', $dll) Then
Sleep(50)
If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
ElseIf BitAND(GUICtrlRead($Checkbox3), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
EndIf
EndIf
If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) = $GUI_CHECKED Then
$PicSave = 1
ElseIf BitAND(GUICtrlRead($Checkbox3), $GUI_UNCHECKED) = $GUI_UNCHECKED Then
$PicSave = 0
EndIf
;X,Y Berechnung per Slider
$x1 = $SliderObenPos / 192 * $iW
$X2 = $SliderUntenPos / 192 * $iW
$X = Round(Min($x1, $X2), 0)
$y1 = $SliderLinksPos / 192 * $iW
$Y2 = $SliderRechtsPos / 192 * $iW
$Y = Round(Min($y1, $Y2), 0)
$y1 = Round($SliderLinksPos / 192 * $iW, 0)
$Y2 = Round($SliderRechtsPos / 192 * $iW, 0)
$w1 = Floor(Abs($SliderObenPos - $SliderUntenPos) / 192 * $iH)
$h1 = Floor(Abs($SliderLinksPos - $SliderRechtsPos) / 192 * $iW)
;Tooltip
If $menuMode = 0 And BitAND(WinGetState($LupeGUI), 2) = 2 Then
If BitAND(WinGetState($LupeGUI), 16) = 16 Then
ToolTip('')
ElseIf BitAND(WinGetState($LupeGUI), 1) = 1 Then
ToolTip(($aWinPos[0] + ($aWinPos[2] / 2)) & ', ' & ($aWinPos[1] + ($aWinPos[3] / 2)), $iX, $iY + $iH)
EndIf
If $SliderLinksPos > $SliderRechtsPos Then
$Ya = $SliderRechtsPos
$Y = $SliderRechtsPos + $iY
$height = $SliderLinksPos - $SliderRechtsPos
$Y2 = $Y + $height
Else
$Ya = $SliderLinksPos
$Y = $SliderLinksPos + $iY
$height = $SliderRechtsPos - $SliderLinksPos
$Y2 = $Y + $height
EndIf
If $SliderObenPos > $SliderUntenPos Then
$Xa = $SliderUntenPos
$X = $SliderUntenPos + $iX
$width = $SliderObenPos - $SliderUntenPos
$X2 = $X + $width
Else
$Xa = $SliderObenPos
$X = $SliderObenPos + $iX
$width = $SliderUntenPos - $SliderObenPos
$X2 = $X + $width
EndIf
ElseIf $menuMode = 1 Then ;ToolTip
ToolTip('Datensatz: ' & $savdat & @CRLF & 'Nr.: ' & $num + 1 & ', x=' & $Pos[0] & ' / y=' & $Pos[1] & @CRLF & 'col=' & $col & @CRLF & 'MitteLupe.: ' & $AuswCol & @CRLF & 'MitteAusw.: ' & $AuswMitte & @CRLF & 'AuswChksm: ' & $auswPixCksm, $Pos[0] + 50, $Pos[1] - 10)
EndIf
;Fenster Animation 'Zusammenhang sichern'
If WinGetState($LupeGUI) = 16 And WinGetState($hLupe) = 2 And $winLupeState = 1 Then
$winLupeState = 0
GUISetState(@SW_HIDE, $hLupe)
WinSetState($hLupe, '', @SW_HIDE)
ElseIf WinGetState($LupeGUI) = 3 And WinGetState($hLupe) <> 2 Then
$winLupeState = 1
GUISetState(@SW_SHOW, $hLupe)
WinSetState($hLupe, '', @SW_SHOW)
EndIf
If _IsPressed('10', $dll) And _IsPressed('01', $dll) Then
;If _IsPressed('01', $dll) Then
$num = $num + 1
$Haus[$num][0] = $num ;Position
$Haus[$num][1] = $Pos[0] ;x-Pos
$Haus[$num][2] = $Pos[1] ;y-Pos
$Haus[$num][3] = $col ;Mouse PixColor
$Haus[$num][4] = $AuswCol ;Lupe Mitte Color (!)
$Haus[$num][5] = $auswPixCksm ;Auswahl Mitte Color
$Haus[$num][6] = ($iX + $X) ;x oben
$Haus[$num][7] = ($iY + $Y) ;y oben
$Haus[$num][8] = ($iX + $X + $w1) ;x unten
$Haus[$num][9] = ($iY + $Y + $h1) ;y unten
;Bild speichern?
If $PicSave = 1 Then
$sDir = 'C:\Dokumente und Einstellungen\Besitzer\Desktop\' & StringFormat('%s.%s.%s\%s', @MDAY, @MON, @YEAR, $num)
DirCreate($sDir)
$sFile1 = $sDir & "\mColors.txt"
$sFile2 = $sDir & "\aColors.txt"
$hFile1 = FileOpen($sFile1, 1) ; 1 = append (anhängen)
$hFile2 = FileOpen($sFile2, 1) ; 1 = append (anhängen)
$hBMP = _ScreenCapture_Capture($sDir & '\Lupe.jpg', $iX, $iY, $iX + $iW, $iY + $iH)
$hBMP2 = _ScreenCapture_Capture($sDir & '\Auswahl.jpg', $iX + $X - 2, $iY + $Y - 2, $iX + $X + $w1, $iY + $Y + $h1)
$hBMPm = _ScreenCapture_Capture($sDir & '\Maus.jpg', $Pos[0] - $pMGr, $Pos[1] - $pMGr, $Pos[0] + $pMGr, $Pos[1] + $pMGr)
_ScreenCapture_SaveImage($sDir & '\Lupe.jpg', $hBMP)
_ScreenCapture_SaveImage($sDir & '\Auswahl.jpg', $hBMP2)
_ScreenCapture_SaveImage($sDir & '\Maus.jpg', $hBMPm)
$colors_A = _getPixelColors($Pos[0] - 10, $Pos[1] - 10, $Pos[0] + 10, $Pos[1] + 10, $hFile1)
$colors_B = _getPixelColors($iX + $X, $iY + $Y, $iX + $X + $w1, $iY + $Y + $h1, $hFile2)
EndIf
;Daten speichern
FileWrite($save, $Haus[$num][0] & ',' & $Haus[$num][1] & ',' & $Haus[$num][2] & ',' & $Haus[$num][3] & ',' & $Haus[$num][4] & ',' & $Haus[$num][5] & ',' & $Haus[$num][6] & ',' & $Haus[$num][7] & ',' & $Haus[$num][8] & ',' & $Haus[$num][9] & @CRLF)
Sleep(100)
;EndIf
EndIf
;Daten für GUI holen und setzen
;$savdat = GUICtrlRead($menu4)
$Pos = MouseGetPos()
$col = PixelGetColor($Pos[0], $Pos[1])
$AuswCol = PixelGetColor($iX + ($iW / 2), $iY + ($iH / 2))
$AuswMitte = PixelGetColor((($iX + $X) + ($w1 / 2)), (($iY + $Y) + ($h1 / 2))) ;Mitte Auswahlrechteck
$auswPixCksm = PixelChecksum(($iX + $X), ($iY + $Y), ($iX + $X) + Abs($SliderLinksPos - $SliderRechtsPos), ($iY + $Y) + Abs($SliderObenPos - $SliderUntenPos)) ;Auswahlrechteck x1,y1,x2,y2
GUICtrlSetData($Input9, 'Maus: ' & PixelGetColor($Pos[0], $Pos[1]))
GUICtrlSetData($Input10, 'Auswahl: ' & PixelGetColor($iX + ($iW / 2), $iY + ($iH / 2)))
GUICtrlSetData($Input11, 'AuswChksm: ' & $auswPixCksm)
GUICtrlSetData($Input7, ' x = ' & $iX + ($Xa / 2) & ', y = ' & $iY + ($Ya / 2))
GUICtrlSetData($Input8, 'Breite = ' & $width & ', Höhe = ' & $height)
WEnd
;Ende 'Schleife'
;Funktionen
Func DatenGUI()
ToolTip('')
WinSetState($hLupe, '', @SW_HIDE)
GUISetState(@SW_HIDE, $LupeGUI)
;GUI
$DatenGUI = GUICreate("Daten erfassen", 220, 110, -1, -1) ; (220x x 180y) will create a dialog box that when displayed is centered
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
$menu3 = GUICtrlCreateMenu("Dateien")
$menuopen = GUICtrlCreateMenuItem("Öffnen", $menu3)
GUICtrlSetOnEvent($menuopen, 'open')
$menuclose = GUICtrlCreateMenuItem("Schliessen", $menu3)
GUICtrlSetOnEvent($menuclose, 'schliessen')
$menuexit = GUICtrlCreateMenuItem("Exit", $menu3)
GUICtrlSetOnEvent($menuexit, 'Beenden')
$n1 = GUICtrlCreateList("", 10, 3, -1, 50)
$bErst = GUICtrlCreateButton("Erstellen", 10, 55, 50, 25)
GUICtrlSetOnEvent($bErst, 'erstellen')
$bHinz = GUICtrlCreateButton("Hinzufügen", 70, 55, 65, 25)
GUICtrlSetOnEvent($bHinz, 'hinzu')
$bBearb = GUICtrlCreateButton("Bearbeiten", 145, 55, 65, 25)
GUICtrlSetOnEvent($bBearb, 'bearbeiten')
GUICtrlSetData($n1, 'Geschäfte|Wohnhäuser|User', 'Geschäfte')
GUICtrlSetState($bHinz, $GUI_FOCUS) ; the focus is on this button
GUISetState()
GUISetState(@SW_SHOW, $DatenGUI)
;WinSetState($hLupe, '', @SW_SHOW)
;ENDE GUI
EndFunc ;==>DatenGUI
Func draw()
; Bild per StretchBlt übertragen
$Lupe = _WinAPI_StretchBlt( _
$hDC_Dest, 32, 30, 192, 192, _
$hDC_Source, $iX, $iY, $iW, $iH, _
$SRCCOPY)
;Auswahl 'Auswahlslider'
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
;Auswahl zeichnen
_GDIPlus_GraphicsDrawLine($hGraphic, 32, 30 + $SliderLinksPos, 222, 30 + $SliderLinksPos, $hPen); oben
_GDIPlus_GraphicsDrawLine($hGraphic, 32, 30 + $SliderRechtsPos, 222, 30 + $SliderRechtsPos, $hPen); unten
_GDIPlus_GraphicsDrawLine($hGraphic, 32 + $SliderObenPos, 30, 32 + $SliderObenPos, 220, $hPen); links
_GDIPlus_GraphicsDrawLine($hGraphic, 32 + $SliderUntenPos, 30, 32 + $SliderUntenPos, 220, $hPen); rechts
EndFunc ;==>draw
Func Min($i, $j)
If $i > $j Then Return $j
Return $i
EndFunc ;==>Min
Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop)
Local $Ret = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', $iXDest, 'int', $iYDest, 'int', $iWidthDest, 'int', $iHeightDest, 'hwnd', $hSrcDC, 'int', $iXSrc, 'int', $iYSrc, 'int', $iWidthSrc, 'int', $iHeightSrc, 'dword', $iRop)
If (@error) Or (Not IsArray($Ret)) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_StretchBlt
Func erstellen()
ToolTip('')
WinSetState($hLupe, '', @SW_HIDE)
WinSetState($DatenGUI, "", @SW_HIDE)
Switch MsgBox(4, "Angaben Korrekt?", 'Sie wollen die Daten für' & @CRLF & GUICtrlRead($n1) & @CRLF & 'neu erstellen?')
Case 6 ; JA
If GUICtrlRead($n1) = 'Geschäfte' Then
$save = FileOpen(@ScriptDir & '\Geschäftsdaten.txt', 2)
ElseIf GUICtrlRead($n1) = 'Wohnhäuser' Then
$save = FileOpen(@ScriptDir & '\Häuserdaten.txt', 2)
ElseIf GUICtrlRead($n1) = 'User' Then
$save = FileOpen(@ScriptDir & '\User.txt', 2)
EndIf
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_HIDE, $LupeGUI)
WinSetState($hLupe, '', @SW_HIDE)
Einloggen()
maximieren()
erfassen($save, $datfile)
Case 7 ; NEIN
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_SHOW, $LupeGUI)
WinSetState($hLupe, '', @SW_SHOW)
EndSwitch
EndFunc ;==>erstellen
Func hinzu()
ToolTip('')
WinSetState($hLupe, '', @SW_HIDE)
WinSetState($DatenGUI, "", @SW_HIDE)
Switch MsgBox(4, "Angaben Korrekt?", 'Sie wollen die Daten für' & @CRLF & GUICtrlRead($n1) & @CRLF & 'erweitern?')
Case 6 ; JA
$hinz = 1
If GUICtrlRead($n1) = 'Geschäfte' Then
$save = FileOpen(@ScriptDir & '\Geschäftsdaten.txt', 1)
$datfile = @ScriptDir & '\Geschäftsdaten.txt'
ElseIf GUICtrlRead($n1) = 'Wohnhäuser' Then
$save = FileOpen(@ScriptDir & '\Häuserdaten.txt', 1)
$datfile = @ScriptDir & '\Häuserdaten.txt'
ElseIf GUICtrlRead($n1) = 'User' Then
$save = FileOpen(@ScriptDir & '\User.txt', 1)
$datfile = @ScriptDir & '\User.txt'
EndIf
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_HIDE, $LupeGUI)
WinSetState($hLupe, '', @SW_HIDE)
Einloggen()
maximieren()
erfassen($save, $datfile)
Case 7 ; NEIN
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_SHOW, $LupeGUI)
WinSetState($hLupe, '', @SW_SHOW)
EndSwitch
EndFunc ;==>hinzu
Func bearbeiten()
If GUICtrlRead($n1) = 'Geschäfte' Then
$run = 'Notepad.exe ' & @ScriptDir & '\Geschäftsdaten.txt'
Run($run)
ElseIf GUICtrlRead($n1) = 'Wohnhäuser' Then
$run = 'Notepad.exe ' & @ScriptDir & '\Häuserdaten.txt'
Run($run)
ElseIf GUICtrlRead($n1) = 'User' Then
$run = 'Notepad.exe ' & @ScriptDir & '\User.txt'
Run($run)
EndIf
EndFunc ;==>bearbeiten
Func open()
$fileopen = FileOpenDialog("Wählen Sie eine Datei aus...", @TempDir, "Alle (*.*)")
If @error Then
MsgBox(4096, "Fehler!", 'Abbruch' & @CRLF & @CRLF & 'Keine Datei ausgewählt!')
Else
$run = 'Notepad.exe ' & $fileopen
Run($run)
EndIf
EndFunc ;==>open
Func Einloggen()
If BitAND($stateface, 1) Then
$handle = WinGetHandle('Facebook')
WinSetState($handle, "", @SW_MAXIMIZE)
$face = 1
$oIE = _IEAttach('Facebook')
$hIE = _IEPropertyGet($oIE, "hwnd")
WinSetState($hIE, "", @SW_MAXIMIZE)
_IENavigate($oIE, $url, 1)
WinActivate($oIE)
_IELoadWait($oIE)
ElseIf BitAND($statemill, 1) And $face = 0 Then
$mill = 1
$handle = WinGetHandle('Millionaire City auf Facebook')
WinSetState($handle, "", @SW_MAXIMIZE)
$oIE = _IEAttach('Facebook')
$hIE = _IEPropertyGet($oIE, "hwnd")
WinSetState($hIE, "", @SW_MAXIMIZE)
WinActivate($oIE)
ElseIf $mill = 0 Then
$oIE = _IECreate($loginurl, 1, 1, 1, 1); $url, $f_tryAttach=0, $f_visible=1, $f_wait=1, $f_takeFocus=1
$hIE = _IEPropertyGet($oIE, "hwnd")
WinSetState($hIE, "", @SW_MAXIMIZE)
_IELoadWait($oIE)
$oInputs = _IETagNameGetCollection($oIE, "input")
$oForm = _IEFormGetCollection($oIE, 0)
$oUser = _IEGetObjByName($oIE, "email")
$oPass = _IEGetObjByName($oIE, "pass")
$oDiv = _IEGetObjById($oIE, "buttons")
_IEFormElementSetValue($oUser, $sUser)
_IEFormElementSetValue($oPass, $sPass)
_IEFormSubmit($oForm)
_IENavigate($oIE, $url)
_IELoadWait($oIE)
Sleep(500)
_IELoadWait($oIE)
EndIf
EndFunc ;==>Einloggen
Func maximieren()
WinActivate("Millionaire City auf Facebook")
WinWaitActive("Millionaire City auf Facebook")
Sleep(250)
MouseClick("left", 1010, 165, 1)
MouseMove(1010, 256, 1)
MouseDown("left")
MouseMove(1010, 350, 20)
MouseUp("left")
MouseClick("left", 769, 500, 3, 20)
MouseClick("left", 771, 530, 1)
Sleep(1000)
MouseMove(737, 544, 1)
MouseDown("left")
MouseMove(749, 408, 30)
MouseUp("left")
Sleep(100)
EndFunc ;==>maximieren
Func erfassen($save, $datfile)
_FileReadToArray($datfile, $count)
If $hinz = 1 Then
$num = $num + $count[0]
EndIf
EndFunc ;==>erfassen
Func speichernunter()
Select
Case @GUI_CtrlId = $mLaden
GUICtrlSetData($menu4, "Geschäftsdaten")
$save = FileOpen(@ScriptDir & '\Geschäftsdaten.txt', 2)
$datfile = @ScriptDir & '\Geschäftsdaten.txt'
$savdat = "Geschäftsdaten"
Case @GUI_CtrlId = $mHaus
GUICtrlSetData($menu4, 'Häuserdaten')
$save = FileOpen(@ScriptDir & '\Häuserdaten.txt', 2)
$datfile = @ScriptDir & '\Häuserdaten.txt'
$savdat = 'Häuserdaten'
Case @GUI_CtrlId = $mUser
GUICtrlSetData($menu4, 'Userdaten')
$save = FileOpen(@ScriptDir & '\User.txt', 2)
$datfile = @ScriptDir & '\User.txt'
$savdat = 'Userdaten'
EndSelect
EndFunc ;==>speichernunter
Func SpecialEvents()
Select
Case @GUI_CtrlId = $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_SHOW, $LupeGUI)
WinSetState($hLupe, '', @SW_SHOW)
Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
;MsgBox(0, "Fenster minimiert", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
Case @GUI_CtrlId = $GUI_EVENT_RESTORE
;MsgBox(0, "Fenster wiederhergestellt", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
EndSelect
EndFunc ;==>SpecialEvents
Func schliessen()
GUISetState(@SW_HIDE, $DatenGUI)
GUISetState(@SW_SHOW, $LupeGUI)
WinSetState($hLupe, '', @SW_SHOW)
EndFunc ;==>schliessen
Func Beenden()
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
FileClose($save)
DllClose($dll)
Exit
EndFunc ;==>Beenden
Func _getPixelColors($start_X, $start_Y, $end_X, $end_Y, $File)
Local $coord[$end_X - $start_X][$end_Y - $start_Y]
For $X = 0 To UBound($coord, 1) - 1
For $Y = 0 To UBound($coord, 2) - 1
$coord[$X][$Y] = PixelGetColor($X + $start_X, $Y + $start_Y)
FileWrite($File, $X & ',' & $Y & ',' & $coord[$X][$Y] & @CRLF)
Next
Next
Return $coord
EndFunc ;==>_getPixelColors
Func DatensatzGUI()
$DatensatzGUI = GUICreate("Datensatz: " & $savdat, 633, 454, 192, 114)
$ListView1 = GUICtrlCreateListView("||||||||", 208, 80, 250, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 5, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 6, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 7, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 8, 50)
_FileReadToArray($datfile, $FileLines)
For $i = 1 To $FileLines[0]
$List[$i] = GUICtrlCreateListViewItem($i, $ListView1)
Next
GUISetState(@SW_SHOW)
EndFunc ;==>DatensatzGUI
;Ende 'Funktionen'
Ja, Danke! ![]()
Des isses!
Hallo,
wie ist es möglich den Namen des Menüs zu ändern?
Und zwar soll dies durch klicken klicken auf ein MenuItem passieren, und der neue Name soll den Namen des MenuItem Namens haben!
Hat da vllt. jemand eine Lösung parat?
Ansatz:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiMenu.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Main", 633, 454, 192, 114)
$MenuItem1 = GUICtrlCreateMenu("Datei")
$MenuItem2 = GUICtrlCreateMenu("-speichern unter-")
$MenuItem4 = GUICtrlCreateMenuItem("Geschäfte", $MenuItem2)
$MenuItem5 = GUICtrlCreateMenuItem("Häuser", $MenuItem2)
$MenuItem6 = GUICtrlCreateMenuItem("User", $MenuItem2)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ende()
Case $msg = $MenuItem4
_GUICtrlMenu_SetItemText($MenuItem2, 0, 'Geschäftsdaten')
Case $msg = $MenuItem5
_GUICtrlMenu_SetItemText($MenuItem2, 0, 'Häuserdaten')
Case $msg = $MenuItem6
_GUICtrlMenu_SetItemText($MenuItem2, 0, 'Userdaten')
EndSelect
WEnd
Func ende()
Exit
EndFunc
Hallo,
ich arbeite immer noch an meiner Lupenfunktion.
Ich glaube die Koordinaten stimmen noch nicht, ausserdem stimmt die Auswahl nicht mit dem gespeichertem Bild überein.
Auch würde ich gern die Zoom-Funktion zum laufen bringen!
Jemand Tipps oder Lösungen?
Bin für jeden Verbesserungsvorschlag dankbar!!
#include <WinAPI.au3>
#include <Misc.au3>
#include <GDIPlus.au3>
#include <GuiSlider.au3>
#include <EditConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
#include <ButtonConstants.au3>
Opt("GUIOnEventMode", 1)
;GUISetState(@SW_SHOW)
HotKeySet("{ESC}", "Beenden")
;declare
Dim $Pos
Dim $PosOld[2]
Dim $PosSlOld[4]
Local $hGUI, $hChild, $hWnd_Desktop, $menu1
Local $hDC_Dest, $hDC_Source, $backbuffer, $X2, $Y2, $X, $Y
Local $iX, $iY, $iW, $iH, $Lupe, $copyLupe
Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo
Local $Sl1ScaleMin, $Sl1ScaleMax, $Sl2ScaleMin, $Sl2ScaleMax, $SliderObenPos, $SliderUntenPos, $SliderLinksPos, $SliderRechtsPos
$Scale = 10
$Sl1ScaleMin = 0
$Sl1ScaleMax = @DesktopWidth
$Sl2ScaleMin = 0
$Sl2ScaleMax = @DesktopHeight
$dll = DllOpen("user32.dll")
$dist = 96
$Border = 4
$PixelDat = 4
$Pos = MouseGetPos()
;GUI
$hGUI = GUICreate("Main", 300, 510, -1, -1, $WS_EX_LAYERED, $WS_EX_TOPMOST)
$menu1 = GUICtrlCreateMenu("File")
$menuexit = GUICtrlCreateMenuitem("Beenden", $menu1)
$Slider1 = GUICtrlCreateSlider(5, 290, 130, 32, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$Slider2 = GUICtrlCreateSlider(5, 345, 130, 32, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$SliderOben = GUICtrlCreateSlider(37, 0, 226, 32, 0, $TBS_NOTICKS)
$SliderUnten = GUICtrlCreateSlider(37, 230, 226, 34, BitOR($TBS_TOP, $TBS_LEFT, $TBS_NOTICKS))
$SliderLinks = GUICtrlCreateSlider(15, 17, 34, 226, $TBS_VERT, $TBS_NOTICKS)
$SliderRechts = GUICtrlCreateSlider(250, 17, 34, 226, BitOR($TBS_VERT, $TBS_NOTICKS, $TBS_TOP, $TBS_LEFT))
$Input1 = GUICtrlCreateInput("", 4, 400, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input2 = GUICtrlCreateInput("", 4, 420, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input3 = GUICtrlCreateInput("", 4, 440, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input4 = GUICtrlCreateInput("", 210, 265, 40, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input5 = GUICtrlCreateInput("", 80, 270, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input6 = GUICtrlCreateInput("", 80, 325, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input7 = GUICtrlCreateInput("", 150, 365, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input8 = GUICtrlCreateInput("", 150, 390, 130, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Pixel = GUICtrlCreateUpdown($Input4)
$Label1 = GUICtrlCreateLabel("Koordinaten:", 5, 383, 64, 17)
$Label2 = GUICtrlCreateLabel(' x - Achse = ', 20, 270, 48, 17)
$Label3 = GUICtrlCreateLabel(' y - Achse = ', 20, 325, 48, 17)
$Label4 = GUICtrlCreateLabel('Auswahl halten', 165, 295, 100, 17, $SS_CENTER)
$Label5 = GUICtrlCreateLabel(' Zoom ', 145, 267, 60, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Label6 = GUICtrlCreateLabel('Auswahl', 170, 348, 65, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Label7 = GUICtrlCreateLabel('Shift zum speichern', 160, 445, 100, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
GUICtrlSetFont($Label4, 9, 800, 4, "MS Sans Serif")
GUICtrlSetFont($Label5, 9, 800, "MS Sans Serif")
GUICtrlSetFont($Label6, 9, 800, 4, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox(" ALT + 1", 175, 312, 80, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_RIGHTBUTTON,$BS_MULTILINE,$BS_FLAT,$WS_TABSTOP,$WS_CLIPSIBLINGS), $WS_EX_STATICEDGE)
$hPen = _GDIPlus_PenCreate()
GUISetState(@SW_SHOW, $hGUI)
GUICtrlSetState($Slider1, $GUI_DISABLE)
GUICtrlSetLimit($Slider1, @DesktopWidth, 0)
GUICtrlSetData($Slider1, $iX)
GUICtrlSetState($Slider2, $GUI_DISABLE)
GUICtrlSetLimit($Slider2, @DesktopHeight, 0)
GUICtrlSetData($Slider2, $iY)
GUICtrlSetLimit($SliderOben, 200, 0)
GUICtrlSetData($SliderOben, 80)
GUICtrlSetLimit($SliderUnten, 200, 0)
GUICtrlSetData($SliderUnten, 120)
GUICtrlSetLimit($SliderLinks, 200, 0)
GUICtrlSetData($SliderLinks, 80)
GUICtrlSetLimit($SliderRechts, 200, 0)
GUICtrlSetData($SliderRechts, 120)
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")
GUICtrlSetOnEvent($menuexit, "Beenden")
GUICtrlSetFont($Label1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetData($Input4, $PixelDat)
$hLupe = GUICreate("", ($dist / 2), ($dist / 2), $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_STATICEDGE), $hGUI)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 0, 0, ($dist / 2), ($dist / 2)), 0xFF0000)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 2, 2, (($dist / 2) - $Border), (($dist / 2) - $Border)), 0xABCDEF)
GUISetState()
_GDIPlus_Startup()
_WinAPI_SetLayeredWindowAttributes($hLupe, 0xABCDEF, 255)
$hWnd_Desktop = _WinAPI_GetDesktopWindow()
$hDC_Source = _WinAPI_GetDC($hWnd_Desktop)
$hDC_Dest = _WinAPI_GetDC($hGUI)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
;Schleife
While GUIGetMsg(1) <> $GUI_EVENT_CLOSE
Sleep(75)
;Slider 'Auswahl Position'
If $SliderLinksPos > $SliderRechtsPos Then
$Ya = $SliderRechtsPos
$Y = $SliderRechtsPos + $iY
$height = $SliderLinksPos - $SliderRechtsPos
$Y2 = $Y + $height
Else
$Ya = $SliderLinksPos
$Y = $SliderLinksPos + $iY
$height = $SliderRechtsPos - $SliderLinksPos
$Y2 = $Y + $height
EndIf
If $SliderObenPos > $SliderUntenPos Then
$Xa = $SliderUntenPos
$X = $SliderUntenPos + $iX
$width = $SliderObenPos - $SliderUntenPos
$X2 = $X +$width
Else
$Xa = $SliderObenPos
$X = $SliderObenPos + $iX
$width = $SliderUntenPos - $SliderObenPos
$X2 = $X + $width
EndIf
GUICtrlSetData($Input4, $PixelDat)
GUICtrlSetData($Input7, ' x = ' & $X & ', y = ' & $Y)
GUICtrlSetData($Input8, ' Breite = ' & $width & ', Höhe = ' & $height)
;Checkbox1
If _IsPressed('12', $dll) And _IsPressed('31', $dll) Then
Sleep(50)
If BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED THEN
GUICtrlSetState ($Checkbox1, $GUI_UNCHECKED)
ElseIf BitAnd(GUICtrlRead($Checkbox1),$GUI_UNCHECKED) = $GUI_UNCHECKED THEN
GUICtrlSetState ($Checkbox1, $GUI_CHECKED)
EndIf
EndIf
;wenn Checkbox1 'unchecked'
If BitAnd(GUICtrlRead($Checkbox1),$GUI_UNCHECKED) = $GUI_UNCHECKED THEN
;Mausposition abfragen
$Pos = MouseGetPos()
; MausAuswahlposition abfragen
$aWinPos = WinGetPos($hLupe)
$iX = $aWinPos[0] ; x
$iY = $aWinPos[1] ; y
$iW = $aWinPos[2] ; width
$iH = $aWinPos[3] ; height
;InfoPost
ToolTip(($aWinPos[0] + ($aWinPos[2] / 2)) & ', ' & ($aWinPos[1] + ($aWinPos[3] / 2)), $iX, $iY + $iH)
GUICtrlSetData($Input1, 'Maus: x = ' & $Pos[0] & ' , y = ' & $Pos[1])
GUICtrlSetData($Input2, 'Lupe: x = ' & $aWinPos[0] & ' , y = ' & $aWinPos[1])
GUICtrlSetData($Input3, 'Horizontal: ' & $countLR & ' , Vertikal: ' & $countHR)
;Wenn sich Mausposition ändert
If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
WinMove($hLupe, "", $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8))
$PosOld = $Pos
$countLR = 0
$countHR = 0
GUICtrlSetData($Slider1, $iX)
GUICtrlSetData($Slider2, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Input6, $iY + ($iH / 2))
EndIf
;Wenn Bewegungstaste gedrückt
If _IsPressed('25', $dll) And $iX > $Sl1ScaleMin Then ;links gedrückt
$countLR = $countLR + (-1)
WinMove($hLupe, "", $iX - $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Slider1, $iX)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('27', $dll) And ($iX + $iW) < $Sl1ScaleMax Then ;rechts gedrückt
$countLR = $countLR + 1
WinMove($hLupe, "", $iX + $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Slider1, $iX)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('26', $dll) And $iY > $Sl2ScaleMin Then ;hoch gedrückt
$countHR = $countHR + (-1)
WinMove($hLupe, "", $iX, $iY - $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
GUICtrlSetData($Slider2, $iY)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('28', $dll) And ($iY + $iH) < $Sl2ScaleMax Then ;runter gedrückt
$countHR = $countHR + 1
WinMove($hLupe, "", $iX, $iY + $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
GUICtrlSetData($Slider2, $iY)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndIf
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
If $SliderObenPos <> $PosSlOld[0] Or $SliderUntenPos <> $PosSlOld[1] Or $SliderLinksPos <> $PosSlOld[2] Or $SliderRechtsPos <> $PosSlOld[3] Then
$PosSlOld[0] = $SliderObenPos
$PosSlOld[1] = $SliderUntenPos
$PosSlOld[2] = $SliderLinksPos
$PosSlOld[3] = $SliderRechtsPos
EndIf
; Bild per StretchBlt übertragen
$Lupe = _WinAPI_StretchBlt( _
$hDC_Dest, 50, 30, 200, 200, _
$hDC_Source, $iX, $iY, $iW, $iH, _
$SRCCOPY)
;Auswahl 'Auswahlslider'
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
;Auswahl zeichnen
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderLinksPos, 248, 30 + $SliderLinksPos, $hPen); oben
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderRechtsPos, 248, 30 + $SliderRechtsPos, $hPen); unten
_GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderObenPos, 30, 50 + $SliderObenPos, 230, $hPen); links
_GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderUntenPos, 30, 50 + $SliderUntenPos, 230, $hPen); rechts
;wenn Checkbox1 'checked'
ElseIf BitAnd(GUICtrlRead($Checkbox1),$GUI_CHECKED) = $GUI_CHECKED THEN
$WinPosSave = WinGetPos($hLupe)
$iX = $WinPosSave[0] ; x
$iY = $WinPosSave[1] ; y
$iW = $WinPosSave[2] ; width
$iH = $WinPosSave[3] ; height
$Lupe = _WinAPI_StretchBlt( _
$hDC_Dest, 50, 30, 200, 200, _
$hDC_Source, $iX, $iY, $iW, $iH, _
$SRCCOPY)
;Auswahl 'Auswahlslider'
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
;Auswahl zeichnen
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderLinksPos, 248, 30 + $SliderLinksPos, $hPen); oben
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderRechtsPos, 248, 30 + $SliderRechtsPos, $hPen); unten
_GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderObenPos, 30, 50 + $SliderObenPos, 230, $hPen); links
_GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderUntenPos, 30, 50 + $SliderUntenPos, 230, $hPen); rechts
EndIf
;Bild speichern
If _IsPressed('10') Then
$x1 = $SliderObenPos / 200 * $iW
$x2 = $SliderUntenPos / 200 * $iW
$x = Round(Min($x1, $x2), 0)
$y1 = $SliderLinksPos/ 200 * $iH
$y2 = $SliderRechtsPos / 200 * $iH
$y = Round(Min($y1, $y2), 0)
$y1 = Round($SliderLinksPos / 200 * $iH, 0)
$y2 = Round($SliderRechtsPos / 200 * $iH, 0)
$h1 = Round(Abs( $SliderLinksPos - $SliderRechtsPos) / 200 * $iH)
$w1 = Round(Abs( $SliderObenPos - $SliderUntenPos) / 200 * $iW, 0)
$hBMP = _ScreenCapture_Capture(@DesktopDir & "\Image.jpg", $iX, $iY, $iX + $iW, $iY + $iH)
$hBMP2 = _ScreenCapture_Capture(@DesktopDir & '\Image2.jpg', $iX + $x - 2, $iY + $y - 2, $iX + $x + $w1, $iY + $y + $h1)
_ScreenCapture_SaveImage(@DesktopDir & "\Lupe.jpg", $hBMP)
_ScreenCapture_SaveImage(@DesktopDir & '\Auswahl.jpg', $hBMP2)
EndIf
WEnd
Func Min($i, $j)
If $i > $j Then Return $j
Return $i
EndFunc
;Funktionen
Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop)
; See _WinAPI_BitBlt
Local $Ret = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', $iXDest, 'int', $iYDest, 'int', $iWidthDest, 'int', $iHeightDest, 'hwnd', $hSrcDC, 'int', $iXSrc, 'int', $iYSrc, 'int', $iWidthSrc, 'int', $iHeightSrc, 'dword', $iRop)
If (@error) Or (Not IsArray($Ret)) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_StretchBlt
Func Beenden()
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>Beenden
Hi,
Edit: also integriert hab ich das jetzt soweit! Ich bekomm des jetzt aber mit dem Backbuffer nicht hin! Aber ich arbeite dran!
Update:
;Start
;include
#include <WinAPI.au3>
#include <Misc.au3>
#include <GDIPlus.au3>
#include <GuiSlider.au3>
#include <EditConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "Beenden")
;declare
Dim $Pos
Dim $PosOld[2]
Dim $PosSlOld[4]
Local $hGUI, $hChild, $hWnd_Desktop, $menu1
Local $hDC_Dest, $hDC_Source, $backbuffer
Local $iX, $iY, $iW, $iH, $Lupe, $copyLupe
Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo
Local $Sl1ScaleMin, $Sl1ScaleMax, $Sl2ScaleMin, $Sl2ScaleMax, $SliderObenPos, $SliderUntenPos, $SliderLinksPos, $SliderRechtsPos
$Scale = 10
$Sl1ScaleMin = 0
$Sl1ScaleMax = @DesktopWidth
$Sl2ScaleMin = 0
$Sl2ScaleMax = @DesktopHeight
$dll = DllOpen("user32.dll")
$dist = 96
$Border = 4
$PixelDat = 10
$Pos = MouseGetPos()
;GUI
$hGUI = GUICreate("Main", 300, 510, -1, -1, $WS_EX_LAYERED, $WS_EX_TOPMOST)
$menu1 = GUICtrlCreateMenu("File")
$menuexit = GUICtrlCreateMenuitem("Beenden", $menu1)
$Slider1 = GUICtrlCreateSlider(5, 290, 160, 32, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$Slider2 = GUICtrlCreateSlider(5, 345, 160, 32, BitOR($TBS_AUTOTICKS, $TBS_BOTH, $TBS_NOTICKS, $TBS_FIXEDLENGTH, $WS_BORDER), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$SliderOben = GUICtrlCreateSlider(37, 0, 226, 32, 0)
$SliderUnten = GUICtrlCreateSlider(37, 230, 226, 34, BitOR($TBS_TOP, $TBS_LEFT))
$SliderLinks = GUICtrlCreateSlider(15, 17, 34, 226, $TBS_VERT)
$SliderRechts = GUICtrlCreateSlider(250, 17, 34, 226, BitOR($TBS_VERT, $TBS_TOP, $TBS_LEFT))
$SliderOben = GUICtrlCreateSlider(37, 0, 226, 32, 0)
$SliderUnten = GUICtrlCreateSlider(37, 230, 226, 34, BitOR($TBS_TOP, $TBS_LEFT))
$SliderLinks = GUICtrlCreateSlider(15, 17, 34, 226, $TBS_VERT)
$SliderRechts = GUICtrlCreateSlider(250, 17, 34, 226, BitOR($TBS_VERT, $TBS_TOP, $TBS_LEFT))
$Input1 = GUICtrlCreateInput("", 4, 400, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input2 = GUICtrlCreateInput("", 4, 420, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input3 = GUICtrlCreateInput("", 4, 440, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input4 = GUICtrlCreateInput("", 220, 400, 50, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input5 = GUICtrlCreateInput("", 60, 270, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input6 = GUICtrlCreateInput("", 60, 325, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Pixel = GUICtrlCreateUpdown($Input4)
$Label1 = GUICtrlCreateLabel("Koordinaten:", 5, 380, 64, 17)
$Label2 = GUICtrlCreateLabel('x - Achse = ', 10, 270, 48, 17)
$Label3 = GUICtrlCreateLabel('y - Achse = ', 10, 325, 48, 17)
$hPen = _GDIPlus_PenCreate()
GUICtrlSetState($Slider1, $GUI_DISABLE)
GUICtrlSetLimit($Slider1, @DesktopWidth, 0)
GUICtrlSetData($Slider1, $iX)
GUICtrlSetState($Slider2, $GUI_DISABLE)
GUICtrlSetLimit($Slider2, @DesktopHeight, 0)
GUICtrlSetData($Slider2, $iY)
GUICtrlSetLimit($SliderOben, 200, 0)
GUICtrlSetData($SliderOben, 80)
GUICtrlSetLimit($SliderUnten, 200, 0)
GUICtrlSetData($SliderUnten, 120)
GUICtrlSetLimit($SliderLinks, 200, 0)
GUICtrlSetData($SliderLinks, 80)
GUICtrlSetLimit($SliderRechts, 200, 0)
GUICtrlSetData($SliderRechts, 120)
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")
GUICtrlSetOnEvent($menuexit, "Beenden")
GUICtrlSetFont($Label1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetData($Input4, $PixelDat)
$hLupe = GUICreate("", ($dist / 2), ($dist / 2), $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_STATICEDGE), $hGUI)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 0, 0, ($dist / 2), ($dist / 2)), 0xFF0000)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 2, 2, (($dist / 2) - $Border), (($dist / 2) - $Border)), 0xABCDEF)
GUISetState()
GUISetState(@SW_SHOW, $hGUI)
_GDIPlus_Startup()
_WinAPI_SetLayeredWindowAttributes($hLupe, 0xABCDEF, 255)
$hWnd_Desktop = _WinAPI_GetDesktopWindow()
$hDC_Source = _WinAPI_GetDC($hWnd_Desktop)
$hDC_Dest = _WinAPI_GetDC($hGUI)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
;Schleife
While GUIGetMsg(1) <> $GUI_EVENT_CLOSE
;Mousposition abfragen
$Pos = MouseGetPos()
; Winposition abfragen
$aWinPos = WinGetPos($hLupe)
$iX = $aWinPos[0] ; x
$iY = $aWinPos[1] ; y
$iW = $aWinPos[2] ; width
$iH = $aWinPos[3] ; height
;Wenn sich Mausposition ändert
If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
WinMove($hLupe, "", $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8))
$PosOld = $Pos
$countLR = 0
$countHR = 0
GUICtrlSetData($Slider1, $iX)
GUICtrlSetData($Slider2, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Input6, $iY + ($iH / 2))
EndIf
;Wenn Bewegungstaste gedrückt
If _IsPressed('25', $dll) And $iX > $Sl1ScaleMin Then ;links gedrückt
$countLR = $countLR + (-1)
WinMove($hLupe, "", $iX - $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Slider1, $iX)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('27', $dll) And ($iX + $iW) < $Sl1ScaleMax Then ;rechts gedrückt
$countLR = $countLR + 1
WinMove($hLupe, "", $iX + $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Slider1, $iX)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('26', $dll) And $iY > $Sl2ScaleMin Then ;hoch gedrückt
$countHR = $countHR + (-1)
WinMove($hLupe, "", $iX, $iY - $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
GUICtrlSetData($Slider2, $iY)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('28', $dll) And ($iY + $iH) < $Sl2ScaleMax Then ;runter gedrückt
$countHR = $countHR + 1
WinMove($hLupe, "", $iX, $iY + $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
GUICtrlSetData($Slider2, $iY)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndIf
;InfoPost
ToolTip(($aWinPos[0] + ($aWinPos[2] / 2)) & ', ' & ($aWinPos[1] + ($aWinPos[3] / 2)), $iX, $iY + $iH)
GUICtrlSetData($Input1, 'Maus: x = ' & $Pos[0] & ' , y = ' & $Pos[1])
GUICtrlSetData($Input2, 'Auswahl: x = ' & $aWinPos[0] & ' , y = ' & $aWinPos[1])
GUICtrlSetData($Input3, 'Horizontal: ' & $countLR & ' , Vertikal: ' & $countHR)
;Pixelgrösse des zu kopierenden Objekts
$PixelDat = 10
GUICtrlSetData($Input4, $PixelDat)
;Bild speichern
If _IsPressed('10') Then
$hBMP = _ScreenCapture_CaptureWnd(@DesktopDir & "\Image.jpg", $hLupe, $iX, $iY, $iX + $iW, $iY + $iH)
_ScreenCapture_SaveImage(@DesktopDir & "\Image.jpg", $hBMP)
EndIf
;Auswahlslider Slider
If $SliderLinksPos > $SliderRechtsPos Then
$Y = $SliderRechtsPos
$height = $SliderLinksPos - $SliderRechtsPos
Else
$Y = $SliderLinksPos
$height = $SliderRechtsPos - $SliderLinksPos
EndIf
If $SliderObenPos > $SliderUntenPos Then
$X = $SliderUntenPos
$width = $SliderObenPos - $SliderUntenPos
Else
$X = $SliderObenPos
$width = $SliderUntenPos - $SliderObenPos
EndIf
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
If $SliderObenPos <> $PosSlOld[0] Or $SliderUntenPos <> $PosSlOld[1] Or $SliderLinksPos <> $PosSlOld[2] Or $SliderRechtsPos <> $PosSlOld[3] Then
$PosSlOld[0] = $SliderObenPos
$PosSlOld[1] = $SliderUntenPos
$PosSlOld[2] = $SliderLinksPos
$PosSlOld[3] = $SliderRechtsPos
EndIf
; Bild per StretchBlt übertragen
$Lupe = _WinAPI_StretchBlt( _
$hDC_Dest, 50, 30, 200, 200, _
$hDC_Source, $iX, $iY, $iW, $iH, _
$SRCCOPY)
_GDIPlus_GraphicsDrawLine($hGraphic, 50, 30 + $SliderLinksPos, 248, 30 + $SliderLinksPos, $hPen); oben
_GDIPlus_GraphicsDrawLine($hGraphic, 50, 30 + $SliderRechtsPos, 248, 30 + $SliderRechtsPos, $hPen); unten
_GDIPlus_GraphicsDrawLine($hGraphic, 50 + $SliderObenPos, 30, 50 + $SliderObenPos, 230, $hPen); links
_GDIPlus_GraphicsDrawLine($hGraphic, 50 + $SliderUntenPos, 30, 50 + $SliderUntenPos, 230, $hPen); rechts
WEnd
;Funktionen
Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop)
; See _WinAPI_BitBlt
Local $Ret = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', $iXDest, 'int', $iYDest, 'int', $iWidthDest, 'int', $iHeightDest, 'hwnd', $hSrcDC, 'int', $iXSrc, 'int', $iYSrc, 'int', $iWidthSrc, 'int', $iHeightSrc, 'dword', $iRop)
If (@error) Or (Not IsArray($Ret)) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_StretchBlt
Func Beenden()
Exit
EndFunc ;==>Beenden
Hallo,
ich habe hier eine Lupenfunktion mit nem durchsichtigen Fenster. Jetzt mochte ich das Script auswahl.au3, bzw die Funktionen zum zeichnen der Linien, gerne in das andere Script integrieren. Jedoch wie bewerkstellige ich des mit dem durchsichtigen Hintergrund? Gibts da eine Pinseleinstellung für?
Bin dankbar für jeden Rat oder Verbesserungsvorschlag!
Lupe:
#include <WinAPI.au3>
#include <Misc.au3>
#include <GDIPlus.au3>
#Include <GuiSlider.au3>
#include <EditConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
Opt("GUIOnEventMode", 1)
;GUISetState(@SW_SHOW)
HotKeySet("{ESC}", "Beenden")
;declare
Dim $Pos
Dim $PosOld[2]
Local $hGUI, $hChild, $hWnd_Desktop, $menu1
Local $hDC_Dest, $hDC_Source
Local $iX, $iY, $iW, $iH, $Lupe, $copyLupe
Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo
Local $Sl1ScaleMin, $Sl1ScaleMax, $Sl2ScaleMin, $Sl2ScaleMax, $SliderObenPos, $SliderUntenPos, $SliderLinksPos, $SliderRechtsPos
$Scale = 10
$Sl1ScaleMin = 0
$Sl1ScaleMax = @DesktopWidth
$Sl2ScaleMin = 0
$Sl2ScaleMax = @DesktopHeight
$dll = DllOpen("user32.dll")
$dist = 96
$Border = 4
$PixelDat = 10
$Pos = MouseGetPos()
;GUI
$hGUI = GUICreate("Main", 300, 485, -1, -1, Default, $WS_EX_TOPMOST)
$menu1 = GUICtrlCreateMenu("File")
$menuexit = GUICtrlCreateMenuitem("Beenden", $menu1)
$Slider1 = GUICtrlCreateSlider(5, 290, 160, 32, BitOR($TBS_AUTOTICKS,$TBS_BOTH,$TBS_NOTICKS,$TBS_FIXEDLENGTH,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Slider2 = GUICtrlCreateSlider(5, 345, 160, 32, BitOR($TBS_AUTOTICKS,$TBS_BOTH,$TBS_NOTICKS,$TBS_FIXEDLENGTH,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$SliderOben = GUICtrlCreateSlider(37, 0, 226, 32, 0)
$SliderUnten = GUICtrlCreateSlider(37, 230, 226, 34, BitOR($TBS_TOP,$TBS_LEFT))
$SliderLinks = GUICtrlCreateSlider(15, 17, 34, 226, $TBS_VERT)
$SliderRechts = GUICtrlCreateSlider(250, 17, 34, 226, BitOR($TBS_VERT,$TBS_TOP,$TBS_LEFT))
$Input1 = GUICtrlCreateInput("", 4, 400, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input2 = GUICtrlCreateInput("", 4, 420, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input3 = GUICtrlCreateInput("", 4, 440, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input4 = GUICtrlCreateInput("", 220, 400, 50, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input5 = GUICtrlCreateInput("", 60, 270, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Input6 = GUICtrlCreateInput("", 60, 325, 30, 17, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_RIGHT))
$Pixel = GUICtrlCreateUpdown($Input4)
$Label1 = GUICtrlCreateLabel("Koordinaten:", 5, 380, 64, 17)
$Label2 = GUICtrlCreateLabel('x - Achse = ', 10, 270, 48, 17)
$Label3 = GUICtrlCreateLabel('y - Achse = ', 10, 325, 48, 17)
$hPen = _GDIPlus_PenCreate()
GUISetState(@SW_SHOW, $hGUI)
GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")
GUICtrlSetOnEvent($menuexit, "Beenden")
GUICtrlSetFont($Label1, 8, 400, 4, "MS Sans Serif")
GUICtrlSetData($Input4, $PixelDat)
$hLupe = GUICreate("", ($dist / 2), ($dist / 2), $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_STATICEDGE), $hGUI)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 0, 0, ($dist / 2), ($dist / 2)), 0xFF0000)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 2, 2, (($dist / 2) - $Border), (($dist / 2) - $Border)), 0xABCDEF)
GUICtrlSetState($Slider1, $GUI_DISABLE)
GUICtrlSetLimit($Slider1, @DesktopWidth, 0)
GUICtrlSetData($Slider1, $iX)
GUICtrlSetState($Slider2, $GUI_DISABLE)
GUICtrlSetLimit($Slider2, @DesktopHeight, 0)
GUICtrlSetData($Slider2, $iY)
GUICtrlSetLimit($SliderOben, 200, 0)
GUICtrlSetData($SliderOben, 100)
GUICtrlSetLimit($SliderUnten, 200, 0)
GUICtrlSetData($SliderUnten, 100)
GUICtrlSetLimit($SliderLinks, 200, 0)
GUICtrlSetData($SliderLinks, 100)
GUICtrlSetLimit($SliderRechts, 200, 0)
GUICtrlSetData($SliderRechts, 100)
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
GUISetState()
;ENDE GUI
_GDIPlus_Startup()
_WinAPI_SetLayeredWindowAttributes($hLupe, 0xABCDEF, 255)
; Desktop und GUI DC holen.
$hWnd_Desktop = _WinAPI_GetDesktopWindow()
$hDC_Source = _WinAPI_GetDC($hWnd_Desktop)
$hDC_Dest = _WinAPI_GetDC($hGUI)
;ENDE declare
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hLupe)
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30, 230, 30, $hPen);
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 230, 230, 50, $hPen)
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30, 390, 150, $hPen)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
;Schleife
While GUIGetMsg(1) <> $GUI_EVENT_CLOSE
Sleep(75)
;Mousposition abfragen
$Pos = MouseGetPos()
; Winposition abfragen
$aWinPos = WinGetPos($hLupe)
$iX = $aWinPos[0] ; x
$iY = $aWinPos[1] ; y
$iW = $aWinPos[2] ; width
$iH = $aWinPos[3] ; height
;Wenn sich Mausposition ändert
If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
WinMove($hLupe, "", $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8))
$PosOld = $Pos
$countLR = 0
$countHR = 0
GUICtrlSetData($Slider1, $iX)
GUICtrlSetData($Slider2, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Input6, $iY + ($iH / 2))
EndIf
;Wenn Bewegungstaste gedrückt
If _IsPressed('25', $dll) And $iX > $Sl1ScaleMin Then ;links gedrückt
$countLR = $countLR + (-1)
WinMove($hLupe, "", $iX - $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Slider1, $iX)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('27', $dll) And ($iX + $iW) < $Sl1ScaleMax Then ;rechts gedrückt
$countLR = $countLR + 1
WinMove($hLupe, "", $iX + $Scale, $iY)
GUICtrlSetData($Input5, $iX + ($iW / 2))
GUICtrlSetData($Slider1, $iX)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('26', $dll) And $iY > $Sl2ScaleMin Then ;hoch gedrückt
$countHR = $countHR + (-1)
WinMove($hLupe, "", $iX, $iY - $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
GUICtrlSetData($Slider2, $iY)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('28', $dll) And ($iY + $iH) < $Sl2ScaleMax Then ;runter gedrückt
$countHR = $countHR + 1
WinMove($hLupe, "", $iX, $iY + $Scale)
GUICtrlSetData($Input6, $iY + ($iH / 2))
GUICtrlSetData($Slider2, $iY)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndIf
;InfoPost
ToolTip(($aWinPos[0] + ($aWinPos[2] / 2)) & ', ' & ($aWinPos[1] + ($aWinPos[3] / 2)), $iX, $iY + $iH)
GUICtrlSetData($Input1, 'Maus: x = ' & $Pos[0] & ' , y = ' & $Pos[1])
GUICtrlSetData($Input2, 'Auswahl: x = ' & $aWinPos[0] & ' , y = ' & $aWinPos[1])
GUICtrlSetData($Input3, 'Horizontal: ' & $countLR & ' , Vertikal: ' & $countHR)
;
; Bild per StretchBlt übertragen
$Lupe = _WinAPI_StretchBlt( _
$hDC_Dest, 50, 30, 200, 200, _
$hDC_Source, $iX, $iY, $iW, $iH, _
$SRCCOPY)
;
;Pixelgrösse des zu kopierenden Objekts
$PixelDat = 10
GUICtrlSetData($Input4, $PixelDat)
;Bild speichern
If _IsPressed('10') Then
$hBMP = _ScreenCapture_CaptureWND(@DesktopDir & "\Image.jpg", $hLupe, $iX, $iY, $iX + $iW, $iY + $iH)
_ScreenCapture_SaveImage (@DesktopDir & "\Image.jpg", $hBmp)
EndIf
WEnd
;Funktionen
Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop)
; See _WinAPI_BitBlt
Local $Ret = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', $iXDest, 'int', $iYDest, 'int', $iWidthDest, 'int', $iHeightDest, 'hwnd', $hSrcDC, 'int', $iXSrc, 'int', $iYSrc, 'int', $iWidthSrc, 'int', $iHeightSrc, 'dword', $iRop)
If (@error) Or (Not IsArray($Ret)) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_StretchBlt
Func Beenden()
Exit
EndFunc ;==>Beenden
Auswahl:
#include <WinAPI.au3>
#include <Misc.au3>
#include <GDIPlus.au3>
#Include <GuiSlider.au3>
#include <EditConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <UpDownConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
Opt("GUIOnEventMode", 1)
HotKeySet("{ESC}", "Beenden")
Dim $Pos
Dim $PosOld[4]
Local $hGUI, $hChild, $hWnd_Desktop, $menu1
Local $hDC_Dest, $hDC_Source, $var
Local $iX, $iY, $iW, $iH, $Lupe, $copyLupe, $X, $Y, $width, $height
Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo
Local $Sl1ScaleMin, $Sl1ScaleMax, $Sl2ScaleMin, $Sl2ScaleMax, $SliderObenPos, $SliderUntenPos, $SliderLinksPos, $SliderRechtsPos
$Scale = 10
$Sl1ScaleMin = 0
$Sl1ScaleMax = @DesktopWidth
$Sl2ScaleMin = 0
$Sl2ScaleMax = @DesktopHeight
$dll = DllOpen("user32.dll")
$dist = 96
$Border = 4
$PixelDat = 10
$Pos = MouseGetPos()
$hGUI = GUICreate("Main", 300, 485, -1, -1, Default, $WS_EX_TOPMOST)
$SliderOben = GUICtrlCreateSlider(37, 0, 226, 32, 0)
$SliderUnten = GUICtrlCreateSlider(37, 230, 226, 34, BitOR($TBS_TOP,$TBS_LEFT))
$SliderLinks = GUICtrlCreateSlider(15, 17, 34, 226, $TBS_VERT)
$SliderRechts = GUICtrlCreateSlider(250, 17, 34, 226, BitOR($TBS_VERT,$TBS_TOP,$TBS_LEFT))
GUISetState(@SW_SHOW, $hGUI)
GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")
GUICtrlSetLimit($SliderOben, 200, 0)
GUICtrlSetData($SliderOben, 80)
GUICtrlSetLimit($SliderUnten, 200, 0)
GUICtrlSetData($SliderUnten, 120)
GUICtrlSetLimit($SliderLinks, 200, 0)
GUICtrlSetData($SliderLinks, 80)
GUICtrlSetLimit($SliderRechts, 200, 0)
GUICtrlSetData($SliderRechts, 120)
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
GUISetState()
_GDIPlus_Startup()
$hPen = _GDIPlus_PenCreate()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
While GUIGetMsg(1) <> $GUI_EVENT_CLOSE
$Pos = MouseGetPos()
$SliderObenPos = _GUICtrlSlider_GetPos($SliderOben)
$SliderUntenPos = _GUICtrlSlider_GetPos($SliderUnten)
$SliderLinksPos = _GUICtrlSlider_GetPos($SliderLinks)
$SliderRechtsPos = _GUICtrlSlider_GetPos($SliderRechts)
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderLinksPos, 248, 30 + $SliderLinksPos, $hPen); oben
_GDIPlus_GraphicsDrawLine ($hGraphic, 50, 30 + $SliderRechtsPos, 248, 30 + $SliderRechtsPos, $hPen); unten
_GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderObenPos, 30, 50 + $SliderObenPos, 230, $hPen); links
_GDIPlus_GraphicsDrawLine ($hGraphic, 50 + $SliderUntenPos, 30, 50 + $SliderUntenPos, 230, $hPen); rechts
If $SliderObenPos <> $PosOld[0] Or $SliderUntenPos <> $PosOld[1] Or $SliderLinksPos <> $PosOld[2] Or $SliderRechtsPos <> $PosOld[3] Then
$PosOld[0] = $SliderObenPos
$PosOld[1] = $SliderUntenPos
$PosOld[2] = $SliderLinksPos
$PosOld[3] = $SliderRechtsPos
_WinAPI_RedrawWindow($hGUI)
EndIf
If $SliderLinksPos > $SliderRechtsPos Then
$Y = $SliderRechtsPos
$height = $SliderLinksPos - $SliderRechtsPos
Else
$Y = $SliderLinksPos
$height = $SliderRechtsPos - $SliderLinksPos
EndIf
If $SliderObenPos > $SliderUntenPos Then
$X = $SliderUntenPos
$width = $SliderObenPos - $SliderUntenPos
Else
$X = $SliderObenPos
$width = $SliderUntenPos - $SliderObenPos
EndIf
ToolTip('o: ' & $PosOld[0] & ', u: ' & $PosOld[1] & ', l: ' & $PosOld[2] & ', r: ' & $PosOld[3] & ' / x: ' & $X & ', y: ' & $Y & ', w: ' & $width & ', h: ' & $height)
WEnd
Func Beenden()
Exit
EndFunc ;==>Beenden
Hi,
habs soweit hinbekommen!
Bin jetzt dabei Controls zum Verändern des Zoomfaktors und des Auswahlrechtecks einzubinden.
Ich bräuchte jetzt noch Hilfe beim erstellen einer neuen GUI die in der Vergrösserung und im Auswahlrechteck zu sehen ist und die sich per INPUT-Feld verändern lässt!
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <Misc.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
Opt("GUIOnEventMode", 1)
GUISetState(@SW_SHOW)
HotKeySet("{ESC}", "Beenden")
;declare
$Scale = 10
$sl1 = 100
$sl2 = 100
$SlScale = 100
$SlScaleMin = -10
$SlScaleMax = 10
$dll = DllOpen("user32.dll")
$dist = 100
Dim $Pos
Dim $PosOld[2]
Local $hGUI, $hChild, $hWnd_Desktop
Local $hDC_Dest, $hDC_Source
Local $iX, $iY, $iW, $iH
Local $countLR, $countHR, $coordLR, $coordHR, $iXo, $iYo
$Pos = MouseGetPos()
;GUI
$hGUI = GUICreate("Main", 200, 400, 0, 0, Default, $WS_EX_TOPMOST)
$Slider1 = GUICtrlCreateSlider(20, 222, 160, 45)
$Slider2 = GUICtrlCreateSlider(20, 285, 160, 45)
$Input1 = GUICtrlCreateInput("", 8, 335, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input2 = GUICtrlCreateInput("", 8, 355, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Input3 = GUICtrlCreateInput("", 8, 375, 184, 20, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Label1 = GUICtrlCreateLabel("Koordinaten:", 5, 318, 64, 17)
$Label2 = GUICtrlCreateLabel("x - Achse", 19, 205, 48, 17)
$Label3 = GUICtrlCreateLabel("y - Achse", 19, 265, 48, 17)
GUISetState(@SW_SHOW, $hGUI)
GUISetOnEvent($GUI_EVENT_CLOSE, "Beenden")
GUICtrlSetState($Slider1, $GUI_DISABLE)
GUICtrlSetLimit($Slider1, 200, 0)
GUICtrlSetData($Slider1, 100)
GUICtrlSetState($Slider2, $GUI_DISABLE)
GUICtrlSetLimit($Slider2, 200, 0)
GUICtrlSetData($Slider2, 100)
GUICtrlSetFont($Label1, 8, 400, 4, "MS Sans Serif")
$hBorder = GUICreate("", ($dist / 2), ($dist / 2), $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8), $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_STATICEDGE), $hGUI)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 0, 0, 50, 50), 0xFF0000)
GUICtrlSetBkColor(GUICtrlCreateLabel("", 2, 2, 46, 46), 0xABCDEF)
GUISetState()
;ENDE GUI
_WinAPI_SetLayeredWindowAttributes($hBorder, 0xABCDEF, 255)
; Desktop und GUI DC holen.
$hWnd_Desktop = _WinAPI_GetDesktopWindow()
$hDC_Source = _WinAPI_GetDC($hWnd_Desktop)
$hDC_Dest = _WinAPI_GetDC($hGUI)
;ENDE declare
;Schleife
While GUIGetMsg() <> $GUI_EVENT_CLOSE
Sleep(75)
$Pos = MouseGetPos()
If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
WinMove($hBorder, "", $Pos[0] + ($dist / 8), $Pos[1] + ($dist / 8))
$PosOld = $Pos
$countLR = 0
$countHR = 0
$sl1 = 100
$sl2 = 100
GUICtrlSetData($Slider1, $SlScale)
GUICtrlSetData($Slider2, $SlScale)
EndIf
;Wenn Bewegungstaste gedrückt
If _IsPressed('25', $dll) And $countLR > $SlScaleMin Then ;links gedrückt
$countLR = $countLR + (-1)
$sl1 = $sl1 - 10
WinMove($hBorder, "", $iX - $Scale, $iY)
GUICtrlSetData($Slider1, $sl1)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('27', $dll) And $countLR < $SlScaleMax Then ;rechts gedrückt
$countLR = $countLR + 1
$sl1 = $sl1 + 10
WinMove($hBorder, "", $iX + $Scale, $iY)
GUICtrlSetData($Slider1, $sl1)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('26', $dll) And $countHR > $SlScaleMin Then ;hoch gedrückt
$countHR = $countHR + (-1)
$sl2 = $sl2 - 10
WinMove($hBorder, "", $iX, $iY - $Scale)
GUICtrlSetData($Slider2, $sl2)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
ElseIf _IsPressed('28', $dll) And $countHR < $SlScaleMax Then ;runter gedrückt
$countHR = $countHR + 1
$sl2 = $sl2 + 10
WinMove($hBorder, "", $iX, $iY + $Scale)
GUICtrlSetData($Slider2, $sl2)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndIf
; Winposition abfragen
$aWinPos = WinGetPos($hBorder)
$iX = $aWinPos[0] ; x
$iY = $aWinPos[1] ; y
$iW = $aWinPos[2] ; width
$iH = $aWinPos[3] ; height
;InfoPost
ToolTip($countLR & ', ' & $countHR)
GUICtrlSetData($Input1, 'Maus: x = ' & $Pos[0] & ' , y = ' & $Pos[1])
GUICtrlSetData($Input2, 'Auswahl: x = ' & $aWinPos[0] & ' , y = ' & $aWinPos[1])
GUICtrlSetData($Input3, 'Ticks, links: ' & $countLR & ' , Ticks, rechts ' & $countHR)
; Bild per StretchBlt übertragen
_WinAPI_StretchBlt( _
$hDC_Dest, 0, 0, 200, 200, _
$hDC_Source, $iX, $iY, $iW, $iH, _
$SRCCOPY)
WEnd
;Funktionen
Func _WinAPI_StretchBlt($hDestDC, $iXDest, $iYDest, $iWidthDest, $iHeightDest, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iRop)
; See _WinAPI_BitBlt
Local $Ret = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', $iXDest, 'int', $iYDest, 'int', $iWidthDest, 'int', $iHeightDest, 'hwnd', $hSrcDC, 'int', $iXSrc, 'int', $iYSrc, 'int', $iWidthSrc, 'int', $iHeightSrc, 'dword', $iRop)
If (@error) Or (Not IsArray($Ret)) Then
Return SetError(1, 0, 0)
EndIf
Return 1
EndFunc ;==>_WinAPI_StretchBlt
Func Beenden()
Exit
EndFunc ;==>Beenden
Hi,
OK, das mit dem Rechteck habbich, jetzt muss ich des Fenster updaten damit ich nicht des alte Rechteck immer seh, wie bewerkstellige ich des? "Edit": Des hab ich jetzt mit
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
gelöst!! Aber jetzt seh ich des Rechteck in der Vergrösserung nicht mehr..mpf!
Und auc, wie grenze ich die Bewegungsgrenze mit den Slidern ein? Z.B., das ich 20 Steps auf dem Slider hab und sich dann des Rechteck nicht über die Grenzen hinaus bewegt?!
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
Opt("GUIOnEventMode", 1)
GUISetState(@SW_SHOW)
HotKeySet("{ESC}", "_Exit")
#region ### START Koda GUI section ### Form=c:\dokumente und einstellungen\besitzer\desktop\au3\lupe.kxf
$Form1 = GUICreate("Form1", 422, 255, 286, 196)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetState($WS_EX_TOPMOST)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$Slider1 = GUICtrlCreateSlider(32, 56, 150, 45)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetLimit($Slider1, 100, 0)
GUICtrlSetData($Slider1, 50)
$Slider2 = GUICtrlCreateSlider(32, 152, 150, 45)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetLimit($Slider2, 100, 0)
GUICtrlSetData($Slider2, 50)
$Input1 = GUICtrlCreateInput("", 224, 32, 150, 21, BitOR($ES_AUTOHSCROLL, $ES_READONLY))
$Label1 = GUICtrlCreateLabel("Koordinaten:", 224, 15, 64, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("x - Achse", 40, 40, 48, 17)
$Label3 = GUICtrlCreateLabel("y - Achse", 40, 136, 48, 17)
#endregion ### END Koda GUI section ###
Dim $iYo, $iXo, $iXu, $iYu, $iXl, $iYl, $iXr, $iYr
Local $hDC, $hPen, $obj_orig
Dim $coordLR, $coordHR, $countLR, $countHR, $ok
Dim $PosOld[2]
$width = 1
$color = 0xFF
$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)
$dist = 5
$Scale = 30
$sl1 = 50
$sl2 = 50
$dll = DllOpen("user32.dll")
Dim $Lay[$Scale + 1][$Scale + 1]
For $x = 1 To $Scale
For $y = 1 To $Scale
$Lay[$x][$y] = GUICtrlCreateLabel("", 224 + $x * 5, 64 + $y * 5, 5, 5, $SS_RIGHT);, BitOR($SS_BLACKRECT, $SS_WHITERECT)) entweder schwarz oder weiss
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT);
Next
Next
;Start GUI Schleife
While 1
$Pos = MouseGetPos()
For $x = 1 To $Scale
For $y = 1 To $Scale
$Pix = PixelGetColor(($Pos[0] + $coordLR) + $x - ($Scale / 2), ($Pos[1] + $coordHR) + $y - ($Scale / 2))
GUICtrlSetBkColor($Lay[$x][$y], $Pix)
Next
Next
;wenn Pfeiltasten gedrückt
If _IsPressed('25', $dll) Then ;links gedrückt
$countLR = $countLR + (-1)
$coordLR = $coordLR - $dist
$sl1 = $sl1 - 10
$iXo = $iXo - $dist
$iXu = $iXu - $dist
$iXl = $iXl - $dist
$iXr = $iXr - $dist
GUICtrlSetData($Slider1, $sl1)
_WinAPI_UpdateWindow($hDC)
ElseIf _IsPressed('27', $dll) Then ;rechts gedrückt
$countLR = $countLR + 1
$coordLR = $coordLR + $dist
$sl1 = $sl1 + 10
$iXo = $iXo + $dist
$iXu = $iXu + $dist
$iXl = $iXl + $dist
$iXr = $iXr + $dist
GUICtrlSetData($Slider1, $sl1)
_WinAPI_UpdateWindow($hDC)
ElseIf _IsPressed('26', $dll) Then ;hoch gedrückt
$countHR = $countHR + (-1)
$coordHR = $coordHR - $dist
$sl2 = $sl2 - 10
$iYo = $iYo - $dist
$iYu = $iYu - $dist
$iYl = $iYl - $dist
$iYr = $iYr - $dist
GUICtrlSetData($Slider2, $sl2)
_WinAPI_UpdateWindow($hDC)
ElseIf _IsPressed('28', $dll) Then ;runter gedrückt
$countHR = $countHR + 1
$coordHR = $coordHR + $dist
$sl2 = $sl2 + 10
$iYo = $iYo + $dist
$iYu = $iYu + $dist
$iYl = $iYl + $dist
$iYr = $iYr + $dist
GUICtrlSetData($Slider2, $sl2)
_WinAPI_UpdateWindow($hDC)
EndIf
_WinAPI_UpdateWindow($hDC)
;wenn Mausbewegung
If $Pos[0] <> $PosOld[0] Or $Pos[1] <> $PosOld[1] Then
$coordHR = 0
$coordLR = 0
$countHR = 0
$countLR = 0
$iYo = 0
$iYu = 0
$iYl = 0
$iYr = 0
$iXo = 0
$iXu = 0
$iXl = 0
$iXr = 0
$PosOld = $Pos
GUICtrlSetData($Slider1, 50)
GUICtrlSetData($Slider2, 50)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
EndIf
;_WinAPI_DrawLine($hDC, $iX1, $iY1, $iX2, $iY2)
;$iX1 X Koordinate des Startpunkts der Linie.
;$iY1 Y Koordinate des Startpunkts der Linie.
;$iX2 X Koordinate des Endpunkts der Linie.
;$iY2 Y Koordinate des Endpunkts der Linie.
;~ _WinAPI_DrawLine($hDC, $Pos[0] - $iX1o, $Pos[1] - $iY1o, $Pos[0] + $iX2o, $Pos[1] - $iY2o) ; oben
;~ _WinAPI_DrawLine($hDC, $Pos[0] - $iX1u, $Pos[1] + $iY1u, $Pos[0] + $iX2u, $Pos[1] + $iY2u) ; untel
;~ _WinAPI_DrawLine($hDC, $Pos[0] + $iX1r, $Pos[1] - $iY1r, $Pos[0] + $iX2r, $Pos[1] + $iY2r) ; rechts
;~ _WinAPI_DrawLine($hDC, $Pos[0] - $iX1l, $Pos[1] - $iY1l, $Pos[0] - $iX2l, $Pos[1] + $iY2l) ; links
_WinAPI_DrawLine($hDC, ($Pos[0] - 15) + $iXo, ($Pos[1] - 15) + $iYo, ($Pos[0] + 16) + $iXo, ($Pos[1] - 15) + $iYo) ; oben
_WinAPI_DrawLine($hDC, ($Pos[0] - 15) + $iXu, ($Pos[1] + 16) + $iYu, ($Pos[0] + 16) + $iXu, ($Pos[1] + 16) + $iYu) ; untel
_WinAPI_DrawLine($hDC, ($Pos[0] + 16) + $iXl, ($Pos[1] - 15) + $iYr, ($Pos[0] + 16) + $iXl, ($Pos[1] + 16) + $iYr) ; rechts
_WinAPI_DrawLine($hDC, ($Pos[0] - 15) + $iXr, ($Pos[1] - 15) + $iYl, ($Pos[0] - 15) + $iXr, ($Pos[1] + 16) + $iYl) ; links
;~ _WinAPI_DrawLine($hDC, ($Pos[0] - 15), ($Pos[1] - 15), ($Pos[0] + 16), ($Pos[1] - 15)) ; oben
;~ _WinAPI_DrawLine($hDC, ($Pos[0] - 15), ($Pos[1] + 16), ($Pos[0] + 16), ($Pos[1] + 16)) ; untel
;~ _WinAPI_DrawLine($hDC, ($Pos[0] + 16), ($Pos[1] - 15), ($Pos[0] + 16), ($Pos[1] + 16)) ; rechts
;~ _WinAPI_DrawLine($hDC, ($Pos[0] - 15), ($Pos[1] - 15), ($Pos[0] - 15), ($Pos[1] + 16)) ; links
ToolTip($countLR & ', ' & $countHR)
GUICtrlSetData($Input1, 'Maus: x=' & $Pos[0] & ', y=' & $Pos[1]); & ' Bild: x=' & $Pos[0] + ($Scale / 2) & ', y=' & $Pos[1] + ($Scale / 2))
Sleep(100)
WEnd
Func Form1Close()
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
Exit
EndFunc ;==>Form1Close
Func _Exit()
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
Exit
EndFunc ;==>_Exit