Pixel "Lebensdauer"

  • Hallo allerseits,

    ich möchte ein Script schreiben, welches mir in einer MsgBox angibt, wie lange ein bestimmter Pixel eine bestimme Farbe hatte.
    Ich habe mir das folgendermaßen vorgestellt, das Script startet, aber es kommt keine MsgBox:

    Do
    While 1
    $1 = PixelGetColor (595,590)
    If $1 = 11406396 then FuncRun()
    WEnd
    Until $1 = 11406396

    Func FuncRun()
    Global $begin = TimerInit()
    EndFunc

    While 1
    $1 = PixelGetColor (595,590)
    If $1 = 9608098 then FuncRun2()
    WEnd

    Func FuncRun2()
    Global $dif = TimerDiff($begin)
    EndFunc

    MsgBox(0, "Time Difference", $dif)


    Kann mir da evtl. jemand weiterhelfen?


    Gruß
    Baum

    Einmal editiert, zuletzt von Baum (13. März 2013 um 22:15)

  • Natürlich passiert nie etwas. Du kommst ja auch nie aus der "While 1" Schlaufe raus. Du musst die While Bedingung ändern. Ich würde das Ganze so lösen:

    Spoiler anzeigen
    [autoit]

    While PixelGetColor(595, 590) <> 11406396
    Sleep(10)
    WEnd

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

    $Timer = TimerInit()

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

    While PixelGetColor(595, 590) = 11406396
    Sleep(10)
    WEnd

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

    MsgBox(0, "Resultat", "Timer Differenz: " & TimerDiff($Timer))

    [/autoit]


    Gruss Shadowigor