Problem mit Screenshot von kleinen Bereichen

  • hey..ich würd gerne screenshots vom ganzen bildschirm machen aber es ist halt wichtig dass es immer nur kleine bereiche mit zb 200x200 pixel sind...dazu habe ich mir dann eine schleife geschrieben damit ich die ganzen werte nicht selber schreiben muss, aber das haut alles noch nicht so richtig hin..ich hoffe ihr könnt helfen...bin echt schon am verzweifeln...

    das problem ist dass manchmal bilder auftreten die komplett schwarz sind (ich denke mal dass die außerhalb meines bildschirmes sind und deßhalb schwarz werden....)


    http://pastebin.com/d155e0cb8

    Einmal editiert, zuletzt von Reaker (9. Januar 2010 um 12:10)

  • Nun ja, erstmal kommt es ja darauf an, was du für eine Auflösung hast.
    Bei mir passiert das selbe, und dieser Laptop hat momentan eine Auflösung von 1024x768 Pixeln...
    Wenn dann bei mir 0|800|200|1000 kommt, kann das nicht klappen.

    Spoiler anzeigen

    Grundkenntnisse in: C++, JavaScript
    Sehr gute Kenntnisse: PHP, JAVA, C und näturlich AutoIt


    Klaviatur, Anhang UDF, GDI+ Mühle

    Zitat

    "Wenn einen um 20h der Pizzadienst anruft und fragt, ob man's nur vergessen hat und ob man das gleiche
    möchte wie immer -- dann sollte man sein Bestellverhalten evtl überdenken"

  • naja ich hab 1920 x 1200 und da funktioniert es auf jeden fall nicht richtig...

    allerdings sollte es eher nicht von der auflösung abhängig sein...


    wie gesagt in der schleife ist irgendwo ein kleiner fehler oder auch in der screenshot funktion...finde ihn aber leider nicht

  • Kannst du bitte die Nummern der Bilder nennen, bei denen es nicht funktioniert?

    Spoiler anzeigen

    Grundkenntnisse in: C++, JavaScript
    Sehr gute Kenntnisse: PHP, JAVA, C und näturlich AutoIt


    Klaviatur, Anhang UDF, GDI+ Mühle

    Zitat

    "Wenn einen um 20h der Pizzadienst anruft und fragt, ob man's nur vergessen hat und ob man das gleiche
    möchte wie immer -- dann sollte man sein Bestellverhalten evtl überdenken"

  • [autoit]

    #include <ScreenCapture.au3>

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

    Global Const $Hoehe = @DesktopHeight
    Global Const $Breite = @DesktopWidth

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

    Global Const $Pix = 200
    Global Const $PFAD = @ScriptDir & "\"

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

    Global $x = 0, $y = 0, $Counter

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

    For $x = 0 To $Breite-$Pix Step $Pix
    For $y = 0 To $Hoehe-$Pix Step $Pix

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

    ConsoleWrite($x & "|" & $y & "|" & $x + $Pix& "|" &$y + $Pix & @LF)
    $Counter +=1
    _ScreenCapture_Capture($PFAD & $Counter & ".jpg", $x, $y, $x + $Pix, $y + $Pix)

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

    Next
    $y = 0
    Next

    [/autoit]

    wie schauts so aus?

    edit: Quellcode nochmals geändert, funktioniert so.

    Einmal editiert, zuletzt von tkausl (8. Januar 2010 um 22:41)

  • so gehts ;)

    Spoiler anzeigen
    [autoit]

    #include <ScreenCapture.au3>

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

    Global Const $Hoehe = @DesktopHeight-1
    Global Const $Breite = @DesktopWidth-1

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

    Global Const $Pix = 200
    Global Const $PFAD = @ScriptDir & "\test\shot\"

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

    Global $x = 0, $y = 0, $Counter

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

    DirRemove($PFAD, 1)
    DirCreate($PFAD)

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

    For $x = 0 To $Breite Step $Pix
    For $y = 0 To $Hoehe Step $Pix
    $Counter += 1
    ConsoleWrite($Counter & @TAB & $x & "|" & $y & "|" & $x + $Pix & "|" & $y + $Pix & @LF)
    _ScreenCapture_Capture($PFAD & $Counter & ".jpg", $x, $y, $x + $Pix, $y + $Pix)
    Next
    Next

    [/autoit]

    Du bist unter anderem aus dem Bildschirm rausgefahren, deshalb

    [autoit]

    Global Const $Hoehe = @DesktopHeight-1
    Global Const $Breite = @DesktopWidth-1

    [/autoit]


    EDIT:
    und so gehts, wenn du keine schwarzen Ränder haben willst :rolleyes:

    Spoiler anzeigen
    [autoit]

    #include <ScreenCapture.au3>

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

    Global Const $Hoehe = @DesktopHeight - 1
    Global Const $Breite = @DesktopWidth - 1

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

    Global Const $Pix = 200
    Global Const $PFAD = @ScriptDir & "\test\shot\"

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

    Global $x = 0, $y = 0, $Counter

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

    Dim $Pix_x_tmp, $Pix_y_tmp

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

    DirRemove($PFAD, 1)
    DirCreate($PFAD)

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

    For $x = 0 To $Breite Step $Pix
    For $y = 0 To $Hoehe Step $Pix
    $Counter += 1

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

    ;Prüfung, ob x zu groß
    If $x + $Pix > $Breite Then
    $Pix_x_tmp = $Breite - $x + 1
    Else
    $Pix_x_tmp = $Pix
    EndIf

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

    ;Prüfung, ob y zu groß
    If $y + $Pix > $Hoehe Then
    $Pix_y_tmp = $Hoehe - $y + 1
    Else
    $Pix_y_tmp = $Pix
    EndIf

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

    ConsoleWrite($Counter & @TAB & $x & "|" & $y & "|" & $x + $Pix_x_tmp & "|" & $y + $Pix_y_tmp & @LF)
    _ScreenCapture_Capture($PFAD & $Counter & ".jpg", $x, $y, $x + $Pix_x_tmp, $y + $Pix_y_tmp)
    Next
    Next

    [/autoit]
  • @tkausl ja funktioniert schonmal gut, allerdings ist zb die uhrzeit noch abgeschnitten...

    @Tweaky...suuper funktioniert einwandfrei...sogar auch noch ohne die schwarzen Ränder...klasse gemacht...


    Dankee an alle die mir geholfen haben insbesondere Tweaky..jetz kann ich heute am Samstag den Tag gleich ohne Problemchen im Hinterkopf starten :):)


    Einmal editiert, zuletzt von Reaker (9. Januar 2010 um 12:52)