1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. funkey

Beiträge von funkey

  • Telnet aus CMD auslesen

    • funkey
    • 17. September 2009 um 14:15

    Surfy: So gehts!

    Spoiler anzeigen
    [autoit]

    #include <Constants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $PID = Run(@ComSpec & " /c " & 'ipconfig', "",@SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    Local $Line
    While 1
    $Line &= StdoutRead($PID)
    If @error Then ExitLoop
    Wend
    MsgBox(0, "", $Line)

    [/autoit] [autoit][/autoit] [autoit]

    $aLine = StringSplit($Line, @CRLF, 3)

    [/autoit]
  • Fenster in der Mitte des Desktop anzeigen lassen mit den erweiterungen ($WS_POPUP,$WS_EX_TOOLWINDOW)

    • funkey
    • 16. September 2009 um 21:57

    Anstelle von 0,0 für die Position einfach -1, -1 schreiben ;)

  • FileGetSize Aktualiesierungsproblem

    • funkey
    • 16. September 2009 um 21:42

    Ich schätze, dass du die Datei nicht schließt, bevor du die Dateigröße abfragst.

  • Doppelklick in Listview auswerten

    • funkey
    • 16. September 2009 um 21:10

    nuts:

    Das hast du doch schon mal selber in dieses Skript eingebaut: ;)

    Spoiler anzeigen
    [autoit]

    #include <GuiListBox.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $oUml = ObjCreate("Scripting.Dictionary") ; Dank an 'BugFix'
    $oUml.Add('ý', '²')
    $oUml.Add('ü', '³')
    $oUml.Add('õ', '§')
    $oUml.Add('ï', '´')
    $oUml.Add('ø', '°')
    $oUml.Add('?', '€')
    $oUml.Add('æ', 'µ')
    $oUml.Add('”', 'ö')
    $oUml.Add('', 'ü')
    $oUml.Add('„', 'ä')
    $oUml.Add('á', 'ß')
    $oUml.Add('Ž', 'Ä')
    $oUml.Add('™', 'Ö')
    $oUml.Add('š', 'Ü')
    $colKeys = $oUml.Keys

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;~ Local $Ordner = 'C:\Programme'
    Local $Ordner = @DesktopDir
    Global $aOrdner
    HotKeySet("{ENTER}", "_Open_Ordner")

    [/autoit] [autoit][/autoit] [autoit]

    $PID = Run(@ComSpec & " /c " & 'dir "'&$Ordner&'" /ad /b', "", @SW_HIDE, 0x2)
    Local $line
    While 1
    $line &= StdoutRead($PID)
    If @error Then ExitLoop
    Wend
    For $strKey In $colKeys
    If StringInStr($line, $strKey, 1) Then $line = StringReplace($line, $strKey, $oUml.Item($strKey))
    Next
    $aOrdner = StringSplit($line, @CRLF, 3)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt('GUIOnEventMode', 1)

    [/autoit] [autoit][/autoit] [autoit]

    $gui = GUICreate('Schnelle Ordnerauswahl by funkey', 400, 600, -1, -1)
    GUISetOnEvent(-3, '_Ende')
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    [/autoit] [autoit][/autoit] [autoit]

    Global $Input = GUICtrlCreateInput('', 10, 10, 380, 20)
    Global $List = GUICtrlCreateList('', 10, 40, 380, 560)
    Global $hList = GUICtrlGetHandle(-1)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To UBound($aOrdner) -2
    GUICtrlSetData(-1, $aOrdner[$i])
    Next

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Check_Eingabe($iwParam)
    switch $iwParam
    case 0x03000003
    _GUICtrlListBox_SetCurSel($hList, _GUICtrlListBox_FindString($hList, GUICtrlRead($Input)))
    EndSwitch
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Open_Ordner()
    If GUICtrlRead($List) <> "" Then ShellExecute($Ordner & '\' & GUICtrlRead($List))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Ende()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    _Check_Eingabe($iwParam)
    Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
    If Not IsHWnd($List) Then $hWndListBox = GUICtrlGetHandle($List)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
    Case $List, $hWndListBox
    Switch $iCode
    Case $LBN_DBLCLK
    _Open_Ordner()
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND (Bugfix - http://www.autoit.de)

    [/autoit]
  • PushTheButton, ermöglicht Mausklick auf sonst nicht erreichbare Grafiken UPDATE 1.36

    • funkey
    • 16. September 2009 um 16:47

    Das funktioniert:

    [autoit]

    $VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 78) ;sm_virtualwidth
    $VirtualDesktopWidth = $VirtualDesktopWidth[0]
    $VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 79) ;sm_virtualheight
    $VirtualDesktopHeight = $VirtualDesktopHeight[0]

    [/autoit]

    Edit: Kanns nicht testen, hab jetzt nur einen Bildschirm :(

    Spoiler anzeigen
    [autoit]

    #include <StructureConstants.au3>
    #include <ScrollBarConstants.au3>
    #include <GuiScrollBars.au3>
    #include <GuiStatusBar.au3>
    #include <GUIConstantsEx.au3>
    #include <GDIPlus.au3>
    #include <Misc.au3>
    #include <string.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ScreenCapture.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("WinTitleMatchMode", 4)
    Opt('GUICloseOnESC', 1)
    Opt('GUIOnEventMode', 1)
    Opt("MouseCoordmode", 1)
    Opt("PixelCoordmode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    ;************Variablen und Konstanten
    Global Const $version = "1.9"
    Global Const $BitmapFullscreen = @ScriptDir & "\FULLSCREEN.bmp"
    Global Const $BitmapSearchArea = @ScriptDir & "\SEARCHAREA.bmp"
    Global Const $maxanzahlpixel = 50 ;wenn mehr pixel, dann bitmapsuche ansonsten pixelsuche
    Const $moviemode = 0 ;Modus, um auch bewegten Hintergrund im Zoomfenster darzustellen 1=EIN(Zoomfenster könnte flimmern) 0=AUS
    Const $c24RGBFullMatch = 1 ;Load as 24 bits and full match
    Global $ZoomWindowFactor = 20, $maxBxHzoomfaktor = 25
    Global $MagZoom = 1, $MagHeight = $ZoomWindowFactor * 8, $MagWidth = $ZoomWindowFactor * 16
    Global $dll[3], $DeskHDC, $GUIHDC, $versatz = 0, $aliste[1][1]
    Global $steps = 1, $run = 0, $hwindow, $zoompressed = 0, $zoom = 0, $exitflag = 0, $x, $y, $anleitungflag = 0, $check = 0
    Global $testfile = "ptb.txt", $Anzahl_bestpixel = 0, $xpos = 1, $ypos = 1, $mausaltx = 100, $mausalty = 100
    Global $xcentersquare, $ycentersquare, $imgBytes = 3
    Local $calcHWND, $pos, $aWinPos, $aWinCSize
    Local $pBitmap, $BitmapData, $pixelFormat
    Local $aStatusbar_Text[5] = [" Ver " & $version, "RGB:", "x/y", "Zoom", "BxH Zoom"], $aStatusbar_Parts[5] = [55, 130, 220, 275, -1]
    $dll[1] = DllOpen("user32.dll")
    $dll[2] = DllOpen("gdi32.dll")

    [/autoit] [autoit][/autoit] [autoit]

    Local $VirtualDesktopWidth = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 78) ;sm_virtualwidth
    Global $DesktopWidth = $VirtualDesktopWidth[0]
    Local $VirtualDesktopHeight = DLLCall("user32.dll", "int", "GetSystemMetrics", "int", 79) ;sm_virtualheight
    Global $DesktopHeight = $VirtualDesktopHeight[0]

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;************Hauptfenster*********
    _GDIPlus_Startup()
    $gui = GUICreate("PushTheButton by Andy@AutoIt.de", $MagWidth + 20, $MagHeight + 100, -1, -1, -1, $WS_EX_TOOLWINDOW)
    $StatusBar = _GUICtrlStatusBar_Create($gui, $aStatusbar_Parts, $aStatusbar_Text)
    $button_finden = GUICtrlCreateButton("Test: Gespeicherten Button finden", 1, 1, 180, 30)
    $button_anleitung = GUICtrlCreateButton("Anleitung zeigen", 1, 1, 110, 30)
    If Not FileExists($testfile) Then ;wenn kein file besteht, erst eins anlegen lt Beschreibung
    GUICtrlSetState($button_finden, BitOR($GUI_DISABLE, $GUI_HIDE))
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    ;*************Fenster Anleitung anzeigen
    $anleitung = GUICreate("Anleitung zu PushTheButton", 500, 160, -1, -1, -1, $WS_EX_TOOLWINDOW)
    $label1 = GUICtrlCreateLabel( _
    "- Zum (Browser)-Fenster navigieren, in dem der gesuchte Button geklickt werden soll" & @CRLF & _
    "- Mauscursor auf den zu drückenden Button/Text platzieren" & @CRLF & _
    "- falls Button ""highlighted"" mit CTRL+ALT+u Mausversatz einsetzen (50 Pixel nach oben)" & @CRLF & _
    "- mit Numpad+ und Numpad- oder dem Mausrad um den Mauscursor herum zoomen" & @CRLF & _
    "- Pfeiltasten hoch, runter, links, rechts um Mauscursor optimal zu positionieren" & @CRLF & _
    "- Ctrl+Alt+Pfeiltasten hoch, runter, links, rechts um die Zoomfenstergröße anzupassen" & @CRLF & _
    "- wenn Mauscursor an optimaler Position, dann CTRL+ALT+m drücken um Buttondaten zu speichern" & @CRLF & _
    "- es wird der Bereich im Zoomfenster in einer Bilddatei gespeichert" & @CRLF & _
    "- zum Testen den Finden-Button aktivieren um nach dem gespeicherten Bereich zu suchen, es wird ggf." & @CRLF & _
    " automatisch nach unten gescrollt und der Mauscursor wird an die gefundene Position gesetzt", 10, 10)

    [/autoit] [autoit][/autoit] [autoit]

    ;*************Zoom-Fenster im Fenster
    Local $titlepic = "Zoom"
    Global $pic = GUICreate($titlepic, $MagWidth, $MagHeight, 10, 10, $ws_popup + $ws_border, $WS_EX_TOPMOST, $gui);, $WS_POPUP, $WS_EX_TOPMOST)
    ;global $pic=GUICtrlCreateGraphic(10,10,160,160)
    Global $hWnd = WinGetHandle($titlepic)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)

    [/autoit] [autoit][/autoit] [autoit]

    ;**************Hotkeys, Message- und Eventhandler
    HotKeySet("^!u", "_Hotkey_u") ;versatz ein/aus
    HotKeySet("{ESC}", "_exitflag") ;wenn ESC gedrückt, dann flag zum beenden der aktuellen Funktion setzen
    HotKeySet("^!m", "_FindBestPixel") ;suche nach der seltensten pixelfarbe
    GUISetOnEvent($GUI_EVENT_CLOSE, "OnAutoItExit", $gui)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_anleitung", $anleitung)
    GUICtrlSetOnEvent($button_finden, "_bereichfinden") ;Pixel auf dem Bildschirm finden
    GUICtrlSetOnEvent($button_anleitung, "_anleitung")
    GUIRegisterMsg($WM_MOVE, '_Dock') ;wenn fenster bewegt wird, child mitbewegen
    GUIRegisterMsg(0x020A, "_ZoomMousewheel") ;wenn Mousewheel bewegt wird, zoomen
    WinSetOnTop($pic, '', 1) ;Zoom immer im Vordergrund
    WinSetOnTop($gui, '', 1) ;Gui immer im Vordergrund
    WinSetOnTop($anleitung, '', 1) ;Gui immer im Vordergrund
    $DeskHDC = DllCall($dll[1], "int", "GetDC", "hwnd", 0) ;handle zum DeviceContext um mit gdi+ zu arbeiten
    $GUIHDC = DllCall($dll[1], "int", "GetDC", "hwnd", $pic)
    _Zoom() ;zoomfenster darstellen
    _Dock() ;dockt das Zoomfenster in/an das Hauptgenster
    _MoveWindows() ;alle Fenster an ihren Platz bringen
    _Show_Windows() ;alle Fenster zeigen
    _ctrl_alt_up() ;

    [/autoit] [autoit][/autoit] [autoit]

    ;************Hauptprogramm
    While 1
    If Not WinActive($gui) Then ;falls gui nicht oberstes Fenster, dann
    Sleep(100)
    WinActivate($gui) ;immer im vordergrund halten
    EndIf
    Sleep(50) ;wartezeit für zoom()
    _zoomen(0) ;mit +- zoomen und mit den pfeiltasten den mauscursor bewegen
    If $moviemode Then _refresh() ;um bewegten hintergrund auch bewegt im fenster darzustellen
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;***********Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUIClose()
    Exit
    EndFunc ;==>_GUIClose

    [/autoit] [autoit][/autoit] [autoit]

    Func _Anleitung()
    If BitAND(WinGetState($anleitung), 2) Then ;anleitungsfenster sichtbar
    $anleitungflag = 0
    GUICtrlSetData($button_anleitung, "Anleitung zeigen")
    GUISetState(@SW_HIDE, $anleitung) ;Fenster verstecken
    Else
    $anleitungflag = 1
    GUICtrlSetData($button_anleitung, "Anleitung verbergen")
    GUISetState(@SW_SHOW, $anleitung) ;Fenster zeigen
    $winposgui = WinGetPos($gui)
    $winposanleitung = WinGetPos($anleitung)
    If $winposgui[0] > $DesktopWidth - $winposgui[2] - $winposanleitung[2] Then ;wenn Anleitungsfenster über den Rand ragt...
    WinMove($gui, "", $DesktopWidth - $winposgui[2] - $winposanleitung[2], $winposgui[1]);...dann Fenster nach links schieben
    EndIf
    EndIf
    EndFunc ;==>_anleitung

    [/autoit] [autoit][/autoit] [autoit]

    Func _Dock() ;dockt das zoomfenster an/in die GUI
    $winposgui = WinGetPos($gui)
    ;WinMove($pic, "", $winposgui[0] + $winposgui[2] - $MagWidth - 20, $winposgui[1] + 30)
    WinMove($anleitung, "", $winposgui[0] + $winposgui[2], $winposgui[1])
    WinMove($pic, "", $winposgui[0] + 10, $winposgui[1] + 30)
    EndFunc ;==>_dock

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Bereichfinden() ;sucht nach dem gespeicherten Bild auf dem Desktop
    _hide_windows() ;gui verstecken
    $start = TimerInit()
    $a = _Buttonfinden() ;auf dem Screen den Button suchen, ggf so lange im aktuellen Fenster nach unten scrollen bis gefunden
    If @error Then ;nicht gefunden
    $t = TimerDiff($start) / 1000
    ConsoleWrite("Nicht gefunden! Suchzeit: " & StringFormat("%.3f", $t) & " Sekunden" & @LF)
    MsgBox(0, "PushTheButton INFO!", "Gespeicherte Daten wurden NICHT in diesem Fenster gefunden!")
    Else
    $t = TimerDiff($start) / 1000
    ConsoleWrite("Gefunden in: " & StringFormat("%.3f", $t) & " Sekunden" & @LF)
    MouseMove($a[0], $a[1], 1) ;mausposition zum hotspot
    MsgBox(0, "Gefunden in " & StringFormat("%.3f", $t) & " Sekunden", "x/y= " & $a[0] & " / " & $a[1] & @CRLF & $check)
    EndIf
    _show_windows()
    EndFunc ;==>_bereichfinden

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Buttonfinden() ;rückgabe x- und y-position des gefundenen hotspots in einem array [0]und[1]
    Local $gefunden = 0
    $exitflag = 0 ;flag, ob ESC gedrückt wurde
    FileOpen("ptb.txt", 1) ;daten lesen
    If @error Then
    MsgBox(0, "Fehler!", "Keine Datei mit Informationen zur Suche gefunden")
    Return -1
    EndIf
    $check = FileReadLine("ptb.txt", 1) ;pixelchecksum
    $pixel = FileReadLine("ptb.txt", 2) ;pixelfarbe in hex RGB
    $Anzahl_bestpixel = Number(FileReadLine("ptb.txt", 3)) ;niedrigste Anzahl der gesuchten Pixel
    $px = FileReadLine("ptb.txt", 4) ;x-Versatz des Hotspots innerhalb des pics
    $py = FileReadLine("ptb.txt", 5) ;y-Versatz des Hotspots innerhalb des pics
    $dx = FileReadLine("ptb.txt", 6) ;breite in pixel
    $dy = FileReadLine("ptb.txt", 7) ;hoehe in pixel
    FileClose("ptb.txt")

    [/autoit] [autoit][/autoit] [autoit]

    If $Anzahl_bestpixel > $maxanzahlpixel Then ;wenn wenige passende farbige pixel auf dem Bildschirm sind...
    ConsoleWrite("Verfahren mit Bitmapsuche gewählt" & @CRLF) ;dann strings suchen (Bitmap2 in Bitmap1 suchen)
    $start = TimerInit()
    Do
    If $exitflag Then ExitLoop ;esc gedrückt
    $alt = PixelChecksum(200, 200, $DesktopWidth, $DesktopHeight) ;bildschirminhalt sichern
    $tresult = _findbmp($BitmapFullscreen, $BitmapSearchArea, $c24RGBFullMatch) ;suchen per stringfunktion in der Bitmap
    If $tresult = 0 Then ;nicht gefunden
    _pagedown() ;runterscrollen
    $tooltip = ToolTip("Suche läuft: Scollen...", $DesktopWidth / 2, $DesktopHeight / 2 + 50)
    Sleep(200) ;wartezeit, bis gescrollt wurde
    $neu = PixelChecksum(200, 200, $DesktopWidth, $DesktopHeight) ;bildschirminhalt nach dem scrollen
    EndIf
    Until $tresult <> 0 Or $alt = $neu ;solange bis true oder nicht mehr weiter zu scrollen
    ToolTip("") ;tooltip löschen
    If $tresult <> 0 Then $gefunden = 1
    Else ;wenn es nur wenige Pixel in der angegebenen Farbe gibt, ist diese Variante mit pixelsearxch schneller
    ConsoleWrite("Verfahren mit Pixelsuche gewählt" & @CRLF)
    Do
    $alt = PixelChecksum(200, 200, $DesktopWidth, $DesktopHeight) ;bildschirminhalt sichern
    Local $x = 0, $y = 0
    While 1
    $pix = PixelSearch($x, $y, $DesktopWidth, $DesktopHeight, Dec($pixel)) ;pixelfarbe suchen
    If @error Or $exitflag Then ExitLoop ;nicht gefunden oder esc gedrückt, dann pagedown
    ;msgbox(0,"pix gefunden an",$pix[0]&" "&$pix[1])
    While 1
    $x = $pix[0] ;x- und y-koordinaten des gefundenen pixels (hotspot)
    $y = $pix[1]
    $prozent = ($y * $DesktopWidth + $x) * 100 / $DesktopWidth / $DesktopHeight
    $tooltip = ToolTip(StringFormat("Suche läuft : %.0f%%", $prozent), $DesktopWidth / 2, $DesktopHeight / 2)
    Local $p1x = $x - $px, $p1y = $y - $py ;umrechnen der hotspotkoordinaten für checksum
    Local $p2x = $p1x + $dx - 1, $p2y = $p1y + $dy - 1
    ; msgbox(0,"pixel mit farbe "&$pixel,$p1x&" "&$p1y&@crlf&$p2x&" "&$p2y&@crlf&PixelChecksum($p1x,$p1y,$p2x,$p2y))
    If PixelChecksum($p1x, $p1y, $p2x, $p2y) = $check Then ;wenn pixelchecksum gleich der gespeicherten pixelchecksum ist, dann gefunden
    $gefunden = 1
    ExitLoop
    EndIf
    $x += 1 ;ein pixel weiter in der zeile
    $pix = PixelSearch($x, $y, $DesktopWidth, $y, Dec($pixel)) ;pixel suchen
    If @error Or $exitflag Then ExitLoop ;wenn in der zeile kein pixel mehr, dann raus
    WEnd
    If $gefunden = 1 Then ExitLoop
    $x = 0 ;neue spalte
    ;msgbox(0,"nächste zeile",0)
    $y += 1 ;neue zeile
    WEnd
    If $exitflag Or $gefunden = 1 Then ExitLoop ;esc gedrückt oder gefunden
    _pagedown() ;runterscrollen
    $tooltip = ToolTip("Suche läuft: Scollen...", $DesktopWidth / 2, $DesktopHeight / 2)
    Sleep(200)
    $neu = PixelChecksum(200, 200, $DesktopWidth, $DesktopHeight)
    Until $alt = $neu ;solange, bis nicht mehr gescrollt werden kann
    EndIf
    $exitflag = 0
    ToolTip("")
    If $gefunden = 0 Then ;gesuchte Pixel nicht gefunden
    SetError(1)
    Return -1
    Else ;gefunden
    SetError(0)
    Dim $koord[2] = [$x, $y]
    Return $koord ;array mit den hotspot-koordinaten zurückgeben
    EndIf
    EndFunc ;==>_Buttonfinden

    [/autoit] [autoit][/autoit] [autoit]

    Func _Hotkey_u() ;versetzt den cursor um 50 pixel nach oben um highlighten zu verhindern
    If $versatz = -50 Then
    $versatz = 0
    MouseMove(MouseGetPos(0), MouseGetPos(1) + 50)
    Else
    $versatz = -50
    MouseMove(MouseGetPos(0), MouseGetPos(1) - 50)
    EndIf
    EndFunc ;==>_Hotkey_u

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exitflag() ;wenn ESC gedrückt, dann Flag setzen
    $exitflag = 1
    EndFunc ;==>_exitflag

    [/autoit] [autoit][/autoit] [autoit]

    Func _Zoomen($zoom) ;zoomfaktor per +-Tasten oder Mausrad oder Ctrl-Alt-Pfeiltasten einstellen
    If _IsPressed("6B", $dll[1]) Or $zoom = 1 Then ;numpad + oder mausrad
    $MagZoom += 2
    If $MagZoom > $ZoomWindowFactor Then $MagZoom = $ZoomWindowFactor
    EndIf
    If _IsPressed("6D", $dll[1]) Or $zoom = 2 Then ;numpad - oder mausrad
    If $MagZoom > 3 Then ;wenn zoom <3 dann kleineren zoomfaktor wählen
    $MagZoom -= 1
    Else
    $MagZoom -= 0.5
    EndIf
    If $MagZoom < 1 Then $MagZoom = 1
    EndIf
    If _IsPressed("25", $dll[1]) Then ;Pfeiltaste links
    If _IsPressed("12", $dll[1]) And _IsPressed("11", $dll[1]) Then ;ctrl+alt+links
    _ctrl_alt_left() ;zoomfenster verkleinern
    Else
    MouseMove(MouseGetPos(0) - 1, MouseGetPos(1), 1)
    EndIf
    EndIf
    If _IsPressed("26", $dll[1]) Then ;Pfeiltaste hoch
    If _IsPressed("12", $dll[1]) And _IsPressed("11", $dll[1]) Then ;ctrl+alt+hoch
    _ctrl_alt_up()
    Else
    MouseMove(MouseGetPos(0), MouseGetPos(1) - 1, 1)
    EndIf
    EndIf
    If _IsPressed("27", $dll[1]) Then ;Pfeiltaste rechts
    If _IsPressed("12", $dll[1]) And _IsPressed("11", $dll[1]) Then ;ctrl+alt+rechts
    _ctrl_alt_right()
    Else
    MouseMove(MouseGetPos(0) + 1, MouseGetPos(1), 1)
    EndIf
    EndIf
    If _IsPressed("28", $dll[1]) Then ;Pfeiltaste runter
    If _IsPressed("12", $dll[1]) And _IsPressed("11", $dll[1]) Then ;ctrl+alt+runter
    _ctrl_alt_down()
    Else
    MouseMove(MouseGetPos(0), MouseGetPos(1) + 1, 1)
    EndIf
    EndIf
    If _mauspostostatusbar() Or _iskeypressed() Or $zoom = 1 Or $zoom = 2 Then _Zoom() ;nur wenn maus bewegt wurde, zoomfenster upgraden
    $hWnd = WinGetHandle($titlepic)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;zoomfenster refresh
    ;msgbox(0,"zoom:",_GDIPlus_ImageGetWidth($hwnd))
    _GUICtrlStatusBar_SetText($StatusBar, "Zoom: " & $MagZoom, 3, 0)
    _GUICtrlStatusBar_SetText($StatusBar, Round($MagWidth / $MagZoom) & " " & Round($MagHeight / $MagZoom), 4, 0)
    EndFunc ;==>_zoomen

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Zoom() ;Zoomfenster
    If MouseGetPos(0) < $MagWidth / 2 / $MagZoom Then ;linker rand
    $xcentersquare = (((MouseGetPos(0) + 1) * $MagZoom) - $MagZoom / 2) - 9
    If MouseGetPos(0) < 19 / 2 / $MagZoom Then
    $xcentersquare = 0
    EndIf
    $xpos = (MouseGetPos(0) - Int(($MagWidth / $MagZoom) / 2))
    If $xpos < 0 Then $xpos = 0
    ; _GUICtrlStatusBar_SetText($StatusBar, "", 3, 0)
    Else
    $xpos = (MouseGetPos(0) - Int(($MagWidth / $MagZoom) / 2))
    $xcentersquare = $MagWidth / 2 - ($ZoomWindowFactor / 2)
    ; _GUICtrlStatusBar_SetText($StatusBar, $xcentersquare&" "&$magwidth/$magzoom, 3, 0)
    If Mod($MagWidth / $MagZoom, 2) = 0 And $MagZoom > (3 / 4 * $ZoomWindowFactor) Then $xcentersquare = $MagWidth / 2
    EndIf
    If MouseGetPos(1) - $versatz < $MagHeight / 2 / $MagZoom Then ;oberer rand
    $ycentersquare = (((MouseGetPos(1) + 1) * $MagZoom) - $MagZoom / 2) - 9
    If MouseGetPos(1) < 19 / 2 / $MagZoom Then
    $ycentersquare = 0
    EndIf
    $ypos = (MouseGetPos(1) - $versatz - Int(($MagHeight / $MagZoom) / 2))
    If $ypos < 0 Then $ypos = 0
    Else
    $ypos = (MouseGetPos(1) - $versatz - Int($MagHeight / $MagZoom / 2))
    $ycentersquare = $MagHeight / 2 - ($ZoomWindowFactor / 2)
    ; _GUICtrlStatusBar_SetText($StatusBar, $xcentersquare&" "&$magwidth/$magzoom, 3, 0)
    If Mod($MagHeight / $MagZoom, 2) = 0 And $MagZoom > (3 / 4 * $ZoomWindowFactor) Then $ycentersquare = $MagHeight / 2
    EndIf
    If MouseGetPos(0) > $DesktopWidth - $MagWidth / $MagZoom Then ;rechter rand
    $xpos = (MouseGetPos(0) - Int(($MagWidth / $MagZoom)) / 2)
    $xcentersquare = $MagWidth / 2 - ($ZoomWindowFactor / 2)
    ;_GUICtrlStatusBar_SetText($StatusBar, $xcentersquare&" "&$magwidth/$magzoom, 4, 0)
    If MouseGetPos(0) > $DesktopWidth - $MagWidth / 2 / $MagZoom Then
    $xpos = $DesktopWidth - $MagWidth / $MagZoom
    $xcentersquare = $MagWidth - (($DesktopWidth - MouseGetPos(0)) * $MagZoom) + $MagZoom / 2 - ($ZoomWindowFactor / 2) - 1
    EndIf
    If $xcentersquare > $MagWidth - $ZoomWindowFactor Then $xcentersquare = $MagWidth - $ZoomWindowFactor
    EndIf
    If MouseGetPos(1) - $versatz > $DesktopHeight - $MagHeight / $MagZoom Then ;unterer rand
    $ypos = (MouseGetPos(1) - $versatz - Int(($MagHeight / $MagZoom)) / 2)
    $ycentersquare = $MagHeight / 2 - ($ZoomWindowFactor / 2)
    If MouseGetPos(1) - $versatz > $DesktopHeight - $MagHeight / 2 / $MagZoom Then
    $ypos = $DesktopHeight - $MagHeight / $MagZoom
    $ycentersquare = $MagHeight - (($DesktopHeight - (MouseGetPos(1) - $versatz)) * $MagZoom) + $MagZoom / 2 - ($ZoomWindowFactor / 2) - 1
    EndIf
    If $ycentersquare > $MagHeight - ($ZoomWindowFactor / 2) Then $ycentersquare = $MagHeight - ($ZoomWindowFactor / 2)
    EndIf
    _refresh()
    EndFunc ;==>_Zoom

    [/autoit] [autoit][/autoit] [autoit]

    Func _Refresh() ;zoomwindow refreshen
    DllCall($dll[2], "int", "StretchBlt", "int", _
    $GUIHDC[0], "int", _ ;handle zielfenster
    0, "int", _ ;x Koordinate zielfenster
    0, "int", _ ;y Koordinate zielfenster
    $MagWidth * $MagZoom, "int", _ ;breite in logischen einheiten (zoom)
    $MagHeight * $MagZoom, "int", _ ;hoehe in logischen einheiten (zoom)
    $DeskHDC[0], "int", _ ;handle quellfenster
    $xpos, "int", _ ;x-position quelle
    $ypos, "int", _ ;y-position quelle
    $MagWidth, "int", _ ;Breite in log einheiten quelle
    $MagHeight, "long", _ ;höhe in log einheiten quelle
    $SRCCOPY) ;verknuepfungsverfahren quelle /ziel
    _GDIPlus_GraphicsDrawRect($hGraphic, $xcentersquare, $ycentersquare, 19, 19) ;markiert bei vollem zoom den hotspot
    _GDIPlus_GraphicsDrawLine($hGraphic, $xcentersquare + 9, 0, $xcentersquare + 9, $ycentersquare)
    _GDIPlus_GraphicsDrawLine($hGraphic, $xcentersquare + 9, $ycentersquare + 19, $xcentersquare + 9, $MagHeight)
    _GDIPlus_GraphicsDrawLine($hGraphic, 0, $ycentersquare + 9, $xcentersquare, $ycentersquare + 9)
    _GDIPlus_GraphicsDrawLine($hGraphic, $xcentersquare + 19, $ycentersquare + 9, $MagWidth, $ycentersquare + 9)
    EndFunc ;==>_refresh

    [/autoit] [autoit][/autoit] [autoit]

    Func OnAutoItExit()
    DllCall($dll[1], "int", "ReleaseDC", "int", $DeskHDC[0], "hwnd", 0)
    DllCall($dll[1], "int", "ReleaseDC", "int", $GUIHDC[0], "hwnd", $gui)
    DllClose($dll[1])
    DllClose($dll[2])
    Exit (0)
    EndFunc ;==>OnAutoItExit

    [/autoit] [autoit][/autoit] [autoit]

    Func _Pagedown() ;wenn jemand weiß wie der ERFOLGTE Scrollevent abgefragt werden kann, bitte melden!
    ;msgbox(0,$sb_pagedown,"scroll",1)
    Send("{PGDN}")
    ;_GUIScrollBars_ScrollWindow($hWindow, 0,100)
    EndFunc ;==>_pagedown

    [/autoit] [autoit][/autoit] [autoit]

    Func _MausposToStatusbar() ;Farbe und Koordinate an der Mauszeigerposition in die Statusbar
    $a = MouseGetPos()
    If Abs($a[0] - $mausaltx) <> 0 Or Abs($a[1] - $mausalty) <> 0 Or $zoom = 1 Or $zoom = 2 Then ;wenn maus oder mausrad bewegt
    $mausaltx = $a[0]
    $mausalty = $a[1]
    $col = Hex(PixelGetColor($a[0], $a[1] - $versatz), 6)
    _GUICtrlStatusBar_SetText($StatusBar, "RGB:" & $col, 1, 0) ;farbe
    _GUICtrlStatusBar_SetText($StatusBar, StringFormat("x:%6d y:%6d", $a[0], $a[1] - $versatz), 2, 0) ;mauspos
    Return 1;statusbar nur beschreiben, wenn Mauscursor sich bewegt hat
    EndIf
    Return 0
    EndFunc ;==>_mauspostostatusbar

    [/autoit] [autoit][/autoit] [autoit]

    Func _ZoomMousewheel($hWnd, $msg, $l, $r) ;abfrage mausrad
    If $l = 0xFF880000 Then ; Mouse wheel up
    _zoomen(1)
    Else ; Mouse wheel down
    _zoomen(2)
    EndIf
    EndFunc ;==>_ZoomMousewheel

    [/autoit] [autoit][/autoit] [autoit]

    Func _Show_Windows() ;alle GUI-Fenster zeigen
    GUISetState(@SW_SHOW, $gui)
    GUISetState(@SW_SHOW, $pic)
    If $anleitungflag = 1 Then GUISetState(@SW_SHOW, $anleitung)
    $hWnd = WinGetHandle($titlepic)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;zoomfenster refresh
    EndFunc ;==>_show_windows

    [/autoit] [autoit][/autoit] [autoit]

    Func _Hide_Windows() ;alle GUI-Fenster verstecken
    GUISetState(@SW_HIDE, $gui)
    GUISetState(@SW_HIDE, $pic)
    GUISetState(@SW_HIDE, $anleitung)
    EndFunc ;==>_hide_windows

    [/autoit] [autoit][/autoit] [autoit]

    Func _FindBestPixel() ;pixel mit der wenigsten Anzahl Farben auf dem Bildschirm suchen
    _hide_windows()
    $MagWidth = (Round($MagWidth / $MagZoom)) * $MagZoom
    $MagHeight = (Round($MagHeight / $MagZoom)) * $MagZoom
    $t = TimerInit()
    $exitflag = 0
    Local $anzahl = 0, $max = 0, $prozent = 0
    Local $dx = ($MagWidth / $MagZoom) ;breite area
    Local $dy = ($MagHeight / $MagZoom) ;höhe area
    ;$p = MouseGetPos()
    Local $p1x = $xpos, $p1y = $ypos
    Local $p2x = $xpos + $dx - 1, $p2y = $ypos + $dy - 1
    $check = PixelChecksum($p1x, $p1y, $p2x, $p2y)
    _ScreenCapture_Capture($BitmapSearchArea, $p1x, $p1y, $p2x + 1, $p2y + 1, False)
    $aret = _analysepic($BitmapSearchArea) ;array, findet die farbe mit den wenigsten pixeln, den hotspot x+y
    ; $info=guigetcursorinfo()
    FileOpen("ptb.txt", 2)
    FileWriteLine("ptb.txt", $check) ;checksum
    FileWriteLine("ptb.txt", $aret[3]) ;pixelfarbe hotspot
    FileWriteLine("ptb.txt", $aret[0]) ;anzahl der Farben
    FileWriteLine("ptb.txt", $aret[1]) ;versatz des hotspot x
    FileWriteLine("ptb.txt", $aret[2]) ;versatz des hotspot y
    FileWriteLine("ptb.txt", $dx) ;breite pic
    FileWriteLine("ptb.txt", $dy) ;höhe pic
    FileClose("ptb.txt")
    ;msgbox(0,"Zeile gespeichert",0)
    GUICtrlSetState($button_finden, $GUI_show + $gui_enable)
    _GUICtrlStatusBar_SetText($StatusBar, ' Pixel gespeichert', 3, 0)
    _show_windows()
    MouseMove($xpos + $aret[1], $ypos + $aret[2] + $versatz)
    EndFunc ;==>_FindBestPixel

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;untersucht, ob Bitmap2 in Bitmap1 enthalten ist
    ;Originalfunc by JunkEW , modified by Andy@ http://www.autoit.de finds the exact match at screen
    Func _FindBMP($BMP1, $BMP2, $MatchType = $c24RGBFullMatch)
    Dim $BMP1Data = "", $BMP1Width = 0, $BMP1Height = 0, $BMP1LineWidth = 0;
    Dim $BMP2Data = "", $BMP2Width = 0, $BMP2Height = 0, $BMP2LineWidth = 0
    Local $searchFor, $line, $iPos = 1
    ; Load the bitmap to search in
    _GetImage($BMP1, $BMP1Data, $BMP1Width, $BMP1Height, $BMP1LineWidth, $imgBytes)
    $BMP1Data = BinaryToString($BMP1Data)
    _GetImage($BMP2, $BMP2Data, $BMP2Width, $BMP2Height, $BMP2LineWidth, $imgBytes)
    $BMP2Data = BinaryToString($BMP2Data)
    If $BMP2Height = 0 Then
    SetError(1, 0, 0)
    Return False
    EndIf
    Local $searchFor1 = StringMid($BMP2Data, 1, ($BMP2Width * $imgBytes)) ;1. pixel-zeile in der bitmap2 (string)
    $iPos = StringInStr($BMP1Data, $searchFor1, 2, 1) ;1. fundstelle des strings in Bitmap2
    ;zeilenweises vergleichen der beiden bitmaps, ist bitmap2 in bitmap1 enthalten?
    While 1
    Local $flag = 0
    If $iPos <> 0 Then
    If ($iPos - 1) / $imgBytes = Int(($iPos - 1) / $imgBytes) Then ;;prüfen ob ipos am anfang eines farbbits steht
    $prozent = $iPos / 3 * 100 / $DesktopWidth / $DesktopHeight
    $tooltip = ToolTip(StringFormat("Suche läuft : %.0f%%", $prozent) & @CRLF & "Zeile " & Int($iPos / $imgBytes / $DesktopWidth), $DesktopWidth / 2, $DesktopHeight / 2)
    For $s = 2 To $BMP2Height ;zeilenweise das suchbild mit dem screen vergleichen
    $searchFor = StringMid($BMP2Data, 1 + (($s - 1) * $BMP2LineWidth), $BMP2Width * $imgBytes) ; s-te zeile aus dem ausschnitt
    $line = StringMid($BMP1Data, $iPos + (($s - 1) * $BMP1LineWidth), $BMP2Width * $imgBytes) ;zeile "unter" der gefundenen zeile im screen
    If $searchFor <> $line Then ;zeilen nicht gleich,
    $flag = 1
    ExitLoop ;exit for/next
    EndIf
    Next
    If $flag = 0 Then ;alle Zeilen haben übereingestimmt, Bitmap gefunden
    $x = Mod(($iPos - 1) / $imgBytes, $DesktopWidth)
    $y = Int(($iPos - 1) / $imgBytes / $DesktopWidth)
    Return 1
    $bMatchPossible = True
    $matchedLines = $BMP2Height
    ExitLoop ;exit while/wend
    EndIf
    $iPos = StringInStr($BMP1Data, $searchFor1, 2, 1, $iPos + $imgBytes)
    If $iPos = 0 Then ExitLoop ;nicht gefunden
    Else ;ipos ist innerhalb eines farbbits und nicht am anfang
    $iPos = StringInStr($BMP1Data, $searchFor1, 2, 1, $iPos + 1)
    If $iPos = 0 Then ExitLoop
    EndIf
    Else
    ExitLoop
    EndIf
    WEnd
    SetError(1, 0, 0)
    Return 0 ;
    EndFunc ;==>findBMP

    [/autoit] [autoit][/autoit] [autoit]

    ;aus einer Datei oder einem Screenshot die Pixeldaten im BGR-Format in einen String schreiben
    ;Originalfunc by JunkEW , modified by Andy@ http://www.autoit.de finds the exact match at screen
    Func _GetImage($BMPFile, ByRef $BMPDataStart, ByRef $Width, ByRef $Height, ByRef $Stride, $imgBytes = 3)
    Local $Scan0, $pixelData, $hbScreen, $pBitmap, $pBitmapCap, $handle
    ; Load the bitmap to search in
    If $BMPFile = $BitmapFullscreen Then
    $hbScreen = _ScreenCapture_Capture("", 0, 0, -1, -1, False)
    $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap
    Else
    ;try to get a handle
    $handle = WinGetHandle($BMPFile)
    If @error Then
    ;Assume its an unknown handle so correct filename should be given
    $pBitmap = _GDIPlus_BitmapCreateFromFile($BMPFile)
    Else
    $hbScreen = _ScreenCapture_CaptureWnd("", $handle, 0, 0, -1, -1, False)
    $pBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hbScreen); returns memory bitmap
    EndIf
    EndIf
    ;_GDIPlus_BitmapLockBits gibt $tagGDIPBITMAPDATA-Struktur zurück
    $BitmapData = _GDIPlus_BitmapLockBits($pBitmap, 0, 0, _GDIPlus_ImageGetWidth($pBitmap), _GDIPlus_ImageGetHeight($pBitmap), $GDIP_ILMREAD, $GDIP_PXF24RGB)
    If @error Then MsgBox(0, "", "Error locking region " & @error)
    $Stride = DllStructGetData($BitmapData, "Stride");Stride - Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up.
    $Width = DllStructGetData($BitmapData, "Width");Image width - Number of pixels in one scan line of the bitmap.
    $Height = DllStructGetData($BitmapData, "Height");Image height - Number of scan lines in the bitmap.
    $pixelFormat = DllStructGetData($BitmapData, "PixelFormat");Pixel format - Integer that specifies the pixel format of the bitmap
    $Scan0 = DllStructGetData($BitmapData, "Scan0");Scan0 - Pointer to the first (index 0) scan line of the bitmap.
    $pixelData = DllStructCreate("ubyte lData[" & (Abs($Stride) * ($Height)) & "]", $Scan0)
    $BMPDataStart = DllStructGetData($pixelData, "lData") ;string, in dem die pixeldaten im BGR-Format stehen

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_BitmapUnlockBits($pBitmap, $BitmapData)
    _GDIPlus_ImageDispose($pBitmap)
    _WinAPI_DeleteObject($pBitmap)
    EndFunc ;==>GetImage

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _ctrl_alt_up() ;fenster verkleinern
    $MagHeight = (Round($MagHeight / $MagZoom)) * $MagZoom - $MagZoom
    If $MagHeight < $ZoomWindowFactor * 3 Then $MagHeight = $ZoomWindowFactor * 3
    _movewindows()
    EndFunc ;==>_ctrl_alt_up

    [/autoit] [autoit][/autoit] [autoit]

    Func _ctrl_alt_down() ;fenster vergrößern
    $MagHeight = (Round($MagHeight / $MagZoom)) * $MagZoom + $MagZoom
    If $MagHeight > $ZoomWindowFactor * $maxBxHzoomfaktor Then $MagHeight = $ZoomWindowFactor * $maxBxHzoomfaktor
    _movewindows()
    EndFunc ;==>_ctrl_alt_down

    [/autoit] [autoit][/autoit] [autoit]

    Func _ctrl_alt_left()
    $MagWidth = (Round($MagWidth / $MagZoom)) * $MagZoom - $MagZoom
    If $MagWidth < $ZoomWindowFactor * 3 Then $MagWidth = $ZoomWindowFactor * 3
    _movewindows()
    EndFunc ;==>_ctrl_alt_left

    [/autoit] [autoit][/autoit] [autoit]

    Func _ctrl_alt_right()
    $MagWidth = (Round($MagWidth / $MagZoom)) * $MagZoom + $MagZoom
    If $MagWidth > $ZoomWindowFactor * $maxBxHzoomfaktor Then $MagWidth = $ZoomWindowFactor * $maxBxHzoomfaktor
    _movewindows()
    EndFunc ;==>_ctrl_alt_right

    [/autoit] [autoit][/autoit] [autoit]

    Func _movewindows() ;alle Fenster vergrössern/verkleinern und die Button-Position anpassen
    _GUICtrlStatusBar_ShowHide($StatusBar, @SW_HIDE) ;statusbar nicht sichtbar, damit sie nicht die buttons "überschreibt"
    If $MagWidth < $ZoomWindowFactor * 16 Then WinMove($gui, "", Default, Default, $ZoomWindowFactor * 16 + 20, $MagHeight + 100)
    If $MagWidth >= $ZoomWindowFactor * 16 Then WinMove($gui, "", Default, Default, $MagWidth + 20, $MagHeight + 100)
    _GUICtrlStatusBar_Resize($StatusBar)
    _GUICtrlStatusBar_ShowHide($StatusBar, @SW_SHOW)
    WinMove($titlepic, "", Default, Default, $MagWidth, $MagHeight)
    $a = WinGetPos($gui)
    GUICtrlSetPos($button_anleitung, 7, $a[3] - 80)
    GUICtrlSetPos($button_finden, $a[2] - 193, $a[3] - 80)
    _dock()
    EndFunc ;==>_movewindows

    [/autoit] [autoit][/autoit] [autoit]

    Func _iskeypressed() ;wenn einer der $allowed-Keys gedrückt ist, rückgabe 1 sonst 0
    $allowed = "6B;6D;25;26;27;28;11;12" ;siehe Hilfe zu _ispressed()
    Global $aKey = StringSplit($allowed, ";", 2)
    For $i = 0 To UBound($aKey) - 1
    If _IsPressed($aKey[$i]) Then Return 1
    Next
    Return 0
    EndFunc ;==>_iskeypressed

    [/autoit] [autoit][/autoit] [autoit]

    Func _AnalysePic($file) ;rückgabe: nach anzahl sortiertes 2-dimensionales array[farbe][anzahl]
    Dim $BMP1Data = "", $BMP1Width = 0, $BMP1Height = 0, $BMP1LineWidth = 0, $imgBytes = 3, $RGB = ""
    Dim $BMP2Data = "", $BMP2Width = 0, $BMP2Height = 0, $BMP2LineWidth = 0
    Local $listindex = 0, $flag = 0, $maxanzahl = 10000000, $prozent = 0
    Dim $aret[4] ;anzahl, posx, posy, color
    Dim $aliste[1]
    _GetImage($BitmapFullscreen, $BMP1Data, $BMP1Width, $BMP1Height, $BMP1LineWidth, $imgBytes)
    $BMP1Data = BinaryToString($BMP1Data)
    ; Load the bitmap to find
    _GetImage($file, $BMP2Data, $BMP2Width, $BMP2Height, $BMP2LineWidth, $imgBytes)
    $BMP2Data = BinaryToString($BMP2Data)
    $t = TimerInit()
    For $h = 0 To $BMP2Height - 1 ;pic durchsuchen
    If $exitflag = 1 Then ExitLoop
    For $b = 0 To $BMP2Width - 1
    $pos = $h * $BMP2LineWidth + ($b * 3 + 1)
    $prozent += 100 / $BMP2Height / $BMP2Width
    $tooltip = ToolTip(StringFormat("Analyse läuft : %.0f%%", $prozent) & @CRLF & "Niedrigste Pixelanzahl " & $maxanzahl & @CRLF & Int(TimerDiff($t) / 1000) & " Sekunden", $DesktopWidth / 2, $DesktopHeight / 2)
    $color = StringMid($BMP2Data, $pos, 3) ;farbe 3 byte, kein hexcode
    $flag = 0
    For $i = 1 To UBound($aliste) - 1
    If $color = $aliste[$i] Then ;farbe im array vorhanden, nächste
    $flag = 1
    ExitLoop
    EndIf
    Next
    If $flag = 0 Then ; keine farbe gefunden im array, neue farbe anlegen
    $listindex += 1
    ReDim $aliste[$listindex]
    $aliste[$listindex - 1] = $color ;farbe
    $anzahl = _pixeltextsearch($BMP1Data, $BMP1LineWidth, $color) ;anzahl color-pixel
    If $anzahl < $maxanzahl Then
    $maxanzahl = $anzahl
    $aret[0] = $anzahl
    $aret[1] = $b ;hotspot x
    $aret[2] = $h ;hotspot y
    $aret[3] = Hex(Asc(StringMid($color, 3, 1)), 2) & Hex(Asc(StringMid($color, 2, 1)), 2) & Hex(Asc(StringMid($color, 1, 1)), 2)
    If $anzahl < 10 Then ;wenn nur 10 Pixel auf dem Bildschirm diese Farbe haben, dann return
    ToolTip("")
    Return $aret
    EndIf
    EndIf
    EndIf
    Next
    Next
    ToolTip("")
    ; _arraydisplay($aret)
    Return $aret
    EndFunc ;==>_analysepic

    [/autoit] [autoit][/autoit] [autoit]

    Func _pixeltextsearch($bmp_data, $bmpstride, $searchcolor); im bmpdata die rgb finden, searchcolor sind die 3 RGB-byte als string
    Local $pos = 0, $anz = 0
    ;~ stringreplace($bmp_data,$searchcolor,$searchcolor,-1,1)
    ;~ return @extended
    If StringInStr($bmp_data, $searchcolor, 1, 500) = 0 Then ;wenn weniger wie 500/3(byte) mal die Farbe vorhanden ist, dann
    Do
    $pos = StringInStr($bmp_data, $searchcolor, 1, 1, $pos + 3) ;schnelle variante ohne prüfung auf bytegrenzen
    $anz += 1
    Until $pos = 0
    Else
    $anz = 500
    EndIf
    Return $anz
    EndFunc ;==>_pixeltextsearch

    [/autoit]
  • Grundsätzliches Auto-It Syntax Verständniss - Gänsefüsschen

    • funkey
    • 16. September 2009 um 16:43

    Mach mal ein k aus dem c, dann siehst du die Fehlermeldung.

    [autoit]

    RunWait(@COMSPEC & ' /k net localgroup /add "meine Gruppe" /Comment:"meine eigene private Testgruppe"')

    [/autoit]
  • Grundsätzliches Auto-It Syntax Verständniss - Gänsefüsschen

    • funkey
    • 16. September 2009 um 16:05

    Es gibt auch einfache 'Füsschen' ;)

    [autoit]

    RunWait(@COMSPEC & ' /c net localgroup /add "meine Gruppe" /Comment:"meine eigene private Testgruppe"')

    [/autoit]
  • Checkboxen auswerten

    • funkey
    • 13. September 2009 um 13:29

    Was macht denn dieser Thread hier im Poweruser-Forum? Ist das Absicht?
    Dann könnte ich ja meine schwierigeren Fragen hier stellen, um sicher zu stellen, dass keine unqualifizierten Antworten kommen. :D8o

  • Checken ob MsgBox im Hintergrund kommt und drauf reagieren

    • funkey
    • 13. September 2009 um 13:11

    So?

    [autoit]

    While 1
    WinWait("OK?", "Would you like to continue?")
    ControlClick("OK?", "Would you like to continue?", "Button1")
    WEnd

    [/autoit]
  • Monitor zu bestimmten Zeiten ein- und ausschalten

    • funkey
    • 12. September 2009 um 02:17

    Ich hatte schon mal ein ähnliches Skript, hab aber jetzt eine kleine Gui azugebaut.

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_Res_LegalCopyright = ©funkey
    #AutoIt3Wrapper_Res_Fileversion = 2.0
    #AutoIt3Wrapper_Res_Description = Monitor-AutoStandby

    [/autoit] [autoit][/autoit] [autoit]

    Opt("TrayMenuMode", 1)
    Opt("TrayOnEventMode", 1)
    Opt('GUIOnEventMode', 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $lciWM_SYSCommand = 274
    Global Const $lciSC_MonitorPower = 61808
    Global Const $lciPower_Off = 2
    Global Const $lciPower_On = -1

    [/autoit] [autoit][/autoit] [autoit]

    Global $title= "Monitor-AutoStandby"
    Global $IniFile = @ScriptDir & '\Monitor-AutoStandby.ini'
    Global $aTime[14]

    [/autoit] [autoit][/autoit] [autoit]

    Global $MonitorIsOff = False

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate($title, 230, 280)
    GUISetOnEvent(-3, '_Exit')
    GUIRegisterMsg(0x004E, '_SaveTimes')

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel('Monitor ein', 80, 10, 60, 20, 0x201)
    GUICtrlCreateLabel('Monitor aus', 150, 10, 60, 20, 0x201)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateButton('Start', 70, 242, 90, 30)
    GUICtrlSetFont(-1, 16, 1000)
    GUICtrlSetOnEvent(-1, '_Start')

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To 6
    GUICtrlCreateLabel(_Wochentag($i+1), 15, 30+30*$i, 60, 20, 0x200)
    $aTime[$i] = GUICtrlCreateDate(IniRead($IniFile, 'Ein', _Wochentag($i+1), "04:00"), 80, 30+30*$i, 60, 20, 0x09)
    GUICtrlSendMsg(-1, 0x1032, 0, "HH:mm")
    $aTime[$i+7] = GUICtrlCreateDate(IniRead($IniFile, 'Aus', _Wochentag($i+1), "20:00"), 150, 30+30*$i, 60, 20, 0x09)
    GUICtrlSendMsg(-1, 0x1032, 0, "HH:mm")
    Next

    [/autoit] [autoit][/autoit] [autoit]

    TrayCreateItem('Einstellungen')
    TrayItemSetOnEvent(-1, '_Show')
    TrayCreateItem('')
    TrayCreateItem('Beenden')
    TrayItemSetOnEvent(-1, '_Exit')

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(20000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _SaveTimes($hWnd, $Msg, $wParam, $lParam)
    $nNotifyCode = BitShift($wParam, 16)
    $nID = BitAND($wParam, 0x0000FFFF)
    $hCtrl = $lParam
    For $i = 0 To 6
    If $nID = $aTime[$i] Then
    IniWrite($IniFile, 'Ein', _Wochentag($i+1), GUICtrlRead($aTime[$i]))
    Return
    EndIf
    Next
    For $i = 7 To 13
    If $nID = $aTime[$i] Then
    IniWrite($IniFile, 'Aus', _Wochentag($i-6), GUICtrlRead($aTime[$i]))
    Return
    EndIf
    Next
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Start()
    GUISetState(@SW_HIDE)
    AdlibEnable('_Check', 500)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Show()
    AdlibDisable()
    GUISetState(@SW_SHOW)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Check()
    Local $Ein = IniRead($IniFile, 'Ein', _Wochentag(@WDAY), "04:00")
    Local $Hour_Ein = StringLeft($Ein, 2), $Min_Ein = StringRight($Ein, 2)
    Local $Aus = IniRead($IniFile, 'Aus', _Wochentag(@WDAY), "20:00")
    Local $Hour_Aus = StringLeft($Aus, 2), $Min_Aus = StringRight($Aus, 2)
    If $Ein = $Aus Then Return
    If @HOUR = $Hour_Aus And @MIN = $Min_Aus And $MonitorIsOff = False Then
    AdlibDisable()
    _Monitor_OFF()
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Wochentag($WDAY)
    Local $aWoTa[7] = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']
    Return $aWoTa[$WDAY -1]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Monitor_ON()
    $MonitorIsOff = False
    Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')

    DllCall('user32.dll', 'int', 'SendMessage', _
    'hwnd', $Progman_hwnd, _
    'int', $lciWM_SYSCommand, _
    'int', $lciSC_MonitorPower, _
    'int', $lciPower_On)
    AdlibEnable('_Check', 500)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Monitor_OFF()
    $MonitorIsOff = True
    Local $Progman_hwnd = WinGetHandle('[CLASS:Progman]')

    While $MonitorIsOff = True
    DllCall('user32.dll', 'int', 'SendMessage', _
    'hwnd', $Progman_hwnd, _
    'int', $lciWM_SYSCommand, _
    'int', $lciSC_MonitorPower, _
    'int', $lciPower_Off)
    _IdleWaitCommit(0)
    Sleep(20)
    WEnd
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _IdleWaitCommit($idlesec)
    Local $iSave, $LastInputInfo = DllStructCreate ("uint;dword")
    DllStructSetData ($LastInputInfo, 1, DllStructGetSize ($LastInputInfo))
    DllCall ("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr ($LastInputInfo))
    Do
    $iSave = DllStructGetData ($LastInputInfo, 2)
    Sleep(60)
    DllCall ("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr ($LastInputInfo))

    Local $Ein = IniRead($IniFile, 'Ein', _Wochentag(@WDAY), "04:00")
    Local $Hour_Ein = StringLeft($Ein, 2), $Min_Ein = StringRight($Ein, 2)
    If @HOUR = $Hour_Ein And @MIN = $Min_Ein Then
    _Monitor_ON()
    EndIf

    Until (DllStructGetData ($LastInputInfo, 2)-$iSave) > $idlesec; Or $MonitorIsOff = False
    Return DllStructGetData ($LastInputInfo, 2)-$iSave
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _Monitor_ON()
    Exit
    EndFunc

    [/autoit]
  • Mit FileInstall kompletten Ordner in das Skript einbinden?

    • funkey
    • 12. September 2009 um 02:08

    Alina: Das funktioniert nicht, da die Quelle bei Fileinstall keine Variable sein darf.

  • Internet Exlorer Optionen --> LAN Einstellungen sofort aufrufen

    • funkey
    • 11. September 2009 um 15:39

    Bei mir geht es so:

    Spoiler anzeigen
    [autoit]

    Run("control.exe inetcpl.cpl,,4")
    WinWait("Eigenschaften von Internet")
    ControlClick("Eigenschaften von Internet", "", "Button10")

    [/autoit]
  • ELBA Login Raiffeisen-Bank Österreich

    • funkey
    • 11. September 2009 um 08:32

    Für den Fall, dass das mal jemand brauchen könnte, habe ich hier ein Login-Skript für das ELektronische BAnking bei der Raiffeisen-Bank in Österreich erstellt.


    ELBA-Login
    [autoit]

    #include <IE.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $BKLZ = 00000
    $KTNR = 00000
    $VFNR = 'xxxxxxx'
    $PIN = 00000

    [/autoit] [autoit][/autoit] [autoit]

    $oIE = _IECreate("https://banking.raiffeisen.at/html/login.jsp")
    $oForm = _IEFormGetObjByName($oIE, "login")
    $oBKLZ = _IEFormElementGetObjByName($oForm, "LOGINBKLZ")
    _IEFormElementSetValue($oBKLZ, $BKLZ)
    $oKTNR = _IEFormElementGetObjByName($oForm, "LOGINKTNR")
    _IEFormElementSetValue($oKTNR, $KTNR)
    $oVFNR = _IEFormElementGetObjByName($oForm, "LOGINVFNR")
    _IEFormElementSetValue($oVFNR, $VFNR)
    _IEFormSubmit($oForm)
    $oForm = _IEFormGetObjByName($oIE, "login")
    $oPIN = _IEFormElementGetObjByName($oForm, "PIN")
    _IEFormElementSetValue($oPIN, $PIN)
    _IEImgClick($oIE, "/html/german/images//button_right.gif")

    [/autoit] [autoit][/autoit] [autoit]

    $Teil1 = _IEPropertyGet($oIE, "locationurl")
    $Teil2 = '?smi.lib=getKonten'
    _IENavigate($oIE, $Teil1 & $Teil2)

    [/autoit]


    Achtung: Dieses Skript ist nur für Leute, die wissen was sie tun. Gebt niemals eure Bankdaten aus der Hand!!!

    Ansonsten viel Spaß damit!

  • Computerzeit ändern

    • funkey
    • 11. September 2009 um 02:21

    Hab auch mal ne Funktion dazu geschrieben ;)

    Spoiler anzeigen
    [autoit]

    Local $year = StringTrimLeft(@YEAR, 2)

    [/autoit] [autoit][/autoit] [autoit]

    _SetYear('08')
    Sleep(3000)
    ;~ ShellExecute ("C:\Program Files\Microsoft Games\Gears of War\Binaries\WarGame-G4WLive")
    ;~ ProcessWaitClose("WarGame-G4WLive.exe")
    _SetYear($year)

    [/autoit] [autoit][/autoit] [autoit]

    Func _SetYear($sYear)
    ;funkey
    Local $sLang = StringRight(@OSLang, 2)
    If $sLang = "07" Then ;German
    RunWait(@ComSpec & " /c " & "date "&@MDAY&"-"&@MON&"-"&$sYear, "", @SW_HIDE)
    ElseIf $sLang = "09" Then ;English
    RunWait(@ComSpec & " /c " & "date "&@MON&"-"&@MDAY&"-"&$sYear, "", @SW_HIDE)
    Else
    Return SetError(1)
    EndIf
    EndFunc

    [/autoit]
  • Icon direkt integrieren/Programmicon als Trayicon verwenden?

    • funkey
    • 10. September 2009 um 17:38

    Du kannst dir doch beim Kompilieren ein Icon aussuchen. ;)

  • Webseiten-AutoLogin mittels Internet Explorer

    • funkey
    • 10. September 2009 um 16:44

    Verbesserte Version siehe Post#1

    Danke fürs Testen!
    Stilgar, danke für deine Linkliste und Reaker danke für 'www.schueler.cc '. Das sollte jetzt (hoffentlich) alles funktionieren.
    Greek, danke für das Lob.


    Wäre dankbar für Links, auf denen es immer noch nicht funktioniert.

  • RichEdit and farben

    • funkey
    • 10. September 2009 um 09:09

    https://autoit.de/index.php?page…90627#post90627

  • wie lautet der befehl wenn eine MsgBox erst beim 2 durchlauf aktiv wird?

    • funkey
    • 10. September 2009 um 03:49

    Du hast deinen Beispielcode ziemlich aus dem Kontext gerissen, aber ungefähr so:

    Spoiler anzeigen
    [autoit]

    Local $iCounter
    If (not $g_bAutoRefresh) Then
    $g_bAutoRefresh = TRUE
    If $iCounter = 1 Then MsgBox(0,"","") ; nur hier die MsgBox soll beim 2 mal aktiv sein
    $iCounter = 1
    Else
    $g_bAutoRefresh = FALSE
    MsgBox(4096, "Aktualisieren", "Aktualisierung von 5 min wurde gestoppt", 5)
    EndIf

    [/autoit]
  • Programm verändern

    • funkey
    • 9. September 2009 um 08:07

    pee du hast den Backslash auch wieder vergessen ;)

    [autoit]

    @ScriptDir & "\db.ini"

    [/autoit]
  • Webseiten-AutoLogin mittels Internet Explorer

    • funkey
    • 9. September 2009 um 03:49

    Hallo!
    Stilgar hat's für den Firefox gemacht ( Web-Seiten-Auto-Login Funktion und Generator für Login-Funktionen(V3.0) ), jetzt gibt es sowas auch für den Internet-Explorer.

    Spoiler anzeigen
    [autoit]

    #include <IE.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Url = 'schueler.cc'
    $User = 'user'
    $Pwd = 'pwd'

    [/autoit] [autoit][/autoit] [autoit]

    $test = _IEAutoLogin($Url, $User, $Pwd)

    [/autoit] [autoit][/autoit] [autoit]

    Func _IEAutoLogin($sUrl, $sUsername, $sPwd)
    ;funkey 09.09.09
    $oIE = _IECreate($sUrl)
    _IEErrorNotify(False)
    _IEErrorHandlerRegister()
    $oForms = _IEFormGetCollection($oIE)
    If @error Then
    Return SetError(1, _IEErrorHandlerDeRegister(), $oIE) ;'no forms --> no login'
    Else
    $Index = 0
    For $oForm In $oForms
    $oFormElements = _IEFormElementGetCollection($oForm)
    If IsObj($oFormElements) Then
    $IndexElement = 0
    For $oElement In $oFormElements
    If $oElement.Type = 'password' Then
    $oPwd = _IEFormElementGetObjByName($oForm, $oElement.Name)
    _IEFormElementSetValue($oPwd, $sPwd)
    For $i = $IndexElement - 1 To 0 Step -1
    $oUser = _IEFormElementGetCollection($oForm, $i)
    If $oUser.Type = 'text' Then
    _IEFormElementSetValue($oUser, $sUsername)
    ExitLoop
    EndIf
    Next
    If $oForm.action <> "0" And Not StringInStr($oForm.action, '.php') Then ;submit
    _IEFormSubmit($oForm, 0)
    _IELoadWait($oIE)
    Else ;click
    For $i = $IndexElement + 1 To $IndexElement + 10 ;check the next 10 elements
    $oButton = _IEFormElementGetCollection($oForm, $i)
    If $oButton.Type = 'submit' Then
    _IEAction($oButton, "click")
    ExitLoop
    EndIf
    Next
    EndIf
    Return SetExtended(_IEErrorHandlerDeRegister(), $oIE)
    EndIf
    $IndexElement += 1
    Next
    EndIf
    $Index += 1
    Next
    EndIf
    Return SetError(2, _IEErrorHandlerDeRegister(), $oIE) ;no password-field found
    EndFunc ;==>_IEAutoLogin

    [/autoit]


    Funktionsweise: Sucht das erste Passwort-Eingabefeld, das gefunden werden kann, schreibt das Passwort dort hinein, danach wird einfach in das Feld davor der Benutzername eingetragen und die Form bestätigt.

    Ich hätte gerne Rückmeldungen über Seiten, auf denen es nicht funktioniert (die gibt es sicher).

    Viel Spaß damit!

    Edit: Kleine Verbesserungen im Errorhandling ;)
    Edit: Die Funktion ist jetzt universeller :rock:

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™