List - automatisches "nach unten scollen"

  • Hey, hier ein BeispielScript ->

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <ListboxConstants.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <StaticConstants.au3>
    #include <ScrollBarConstants.au3>
    #include <Date.au3>
    #include <EditConstants.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $hGui = GUICreate("Meine GUI List", 800, 600)
    GUISetOnEvent(-3, "_Exit")
    $sSpace = " "
    $listLog = GUICtrlCreateList($sSpace & "Log <- Hier halte ich dich up2date! ->", 50, 480, 520, 100, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL), $WS_EX_WINDOWEDGE)
    GUISetState(@SW_SHOW)

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

    While Sleep(1000)
    _log("Hi")
    WEnd

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

    Func _log($text)
    $aResult = StringRegExp($text, ".{35,45}( .)", 3)
    If Not @error Then
    $aAResult = StringTrimLeft($aResult[0], 1)
    GUICtrlSetData($listLog, _NowTime() & " -> " & StringReplace($text, $aResult[0], "|" & $aAResult, 1) & "|")
    Else
    GUICtrlSetData($listLog, _NowTime() & " -> " & $text & "|")
    EndIf
    EndFunc ;==>_log

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

    Func _Exit()
    Exit
    EndFunc

    [/autoit]


    Wie mache ich, dass das Script automatisch mit scrollt? -.- Bin die ganze Zeit am Rumprobieren und irgendwie bringen die List-Befehle einen da auch nicht weiter...


    LG

    Einmal editiert, zuletzt von Acanis (4. August 2010 um 19:43)

    • Offizieller Beitrag

    Einfach die Funktion "_log" um eine Zeile erweitern:

    [autoit]


    Func _log($text)
    $aResult = StringRegExp($text, ".{35,45}( .)", 3)
    If Not @error Then
    $aAResult = StringTrimLeft($aResult[0], 1)
    GUICtrlSetData($listLog, _NowTime() & " -> " & StringReplace($text, $aResult[0], "|" & $aAResult, 1) & "|")
    Else
    GUICtrlSetData($listLog, _NowTime() & " -> " & $text & "|")
    EndIf
    _GUICtrlListBox_SetTopIndex($listLog, _GUICtrlListBox_GetCount($listLog) - 1)
    EndFunc ;==>_log

    [/autoit]