Directory Liste in Treeview anzeigen

  • Hallo Alle,

    ich möchte folgende Liste in einem Treeview anzeigen, jedes Verzeichnis soll nur 1 * angezeigt werden.

    Hier meine Beispiel-Liste:

    Spoiler anzeigen


    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Anti-Stress_music.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Messiah_-_Thunderdome_Spicelab_Mix.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Omni_Mode_-_Galaxy_of_Rhythm.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Patrick Hernandez Born To Be Alive - YouTube.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Patrick_Hernandez_-_Born_to_be_alive.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Patrick_Hernandez_Born_To_Be_Alive.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Slow_Music_-_e.g._for_Cool_Down_After_Working_Out_-_relaxdaily_N_022.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\test.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\VIVA_Housefrau_1995_1.5._Party_Termine._Omni_Mode_-_Galaxy_of_Rhythm.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Eigene Musik\Lady Gaga - Bad Romance.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Eigene Musik\test.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\Eigene Musik\Herbst2012\Patrick Hernandez Born to be alive 12.mp4
    C:\Dokumente und Einstellungen\Freddy.FREDDY-8ABED5F6\Eigene Dateien\MP4 to MP3 Konverter\Lame\test.mp4


    Hier ist mein Progi, soweit fertig. Ich komme aber nicht weiter! ?(

    Spoiler anzeigen
    [autoit]


    ;~ #cs

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

    #Include <GUIConstants.au3>
    #include <GuiTreeView.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    #Include <GuiListView.au3>
    #include <File.au3>
    #include <IE.au3>
    #include <date.au3>
    #include <String.au3>
    #include <GuiConstants.au3>
    #include <StaticConstants.au3>

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

    Global $Tree
    Global $SubTree
    Global $files
    Global $suchPfad = """" & @MyDocumentsDir & "\*.mp4" & """"
    Global $Liste[100][100]
    Global $hParent
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $suchPfad = ' & $suchPfad & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

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

    $Form1 = GUICreate("Browse", 243, 319, 463, 281)
    $TreeView = GUICtrlCreateTreeView(8, 8, 225, 273, BitOR($WS_BORDER,$TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS))
    GUICtrlSetImage(-1, "shell32.dll", 3, 4)
    GUICtrlSetImage(-1, "shell32.dll", 4, 2)
    $ok = GUICtrlCreateButton(">>>>>>>>>>>> &Weiter >>>>>>>>>>>>", 8, 288, 227, 25)
    GUISetState(@SW_SHOW)

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

    $rc = filedelete(@ScriptDir & "\DirList.txt")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $rc = RunWait(@ComSpec & " /c " & " dir " & $suchPfad & " /s /b > DirList.txt",@ScriptDir,@SW_HIDE)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $rc = _FileReadToArray(@ScriptDir & "\DirList.txt", $files)
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    for $i = 1 to $files[0]
    $TeilPfade = StringSplit($files[$i], "\")
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $TeilPfade = ' & $TeilPfade[0] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    for $y = 1 to $TeilPfade[0] - 1
    $liste[$i-1][$y-1] = $TeilPfade[$y]
    Next
    next
    ; _ArrayDisplay($Liste, "Debug")

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

    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : UBound($Liste, 2) = ' & UBound($Liste, 2) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    for $i = 1 to UBound($Liste, 1) - 1
    if $Liste[$i][0] = "" then ExitLoop
    _ArrayDisplay($Liste[$i][0], "Debug")
    $s = ""
    for $y = 0 to UBound($Liste, 2)-1
    if $Liste[$i][$y] <> "" then
    $s &= $Liste[$i][$y] & "\"
    ; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Liste[' & $i & '][' & $y & '] = ' & $Liste[$i][$y] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $hItemFound = _GUICtrlTreeView_FindItemEx($TreeView, $s)
    if not $hItemFound Then
    $items = StringSplit($s, "\")
    ; _arraydisplay($items, "debug")
    for $l = 1 to Ubound($items) - 1
    $hItemFound = _GUICtrlTreeView_FindItemEx($TreeView, $items[$l])
    if not $hItemFound Then
    if $hParent Then
    $hParentNew = GUICtrlCreateTreeViewItem($items[$l], $hParent)
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hParent = ' & $hParent & ' $hParentNew = ' & $hParentNew & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    $hParent = $hParentNew
    else
    $hParent = GUICtrlCreateTreeViewItem($items[$l], $TreeView)
    endif
    endif
    next
    endif
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $s = ' & $s & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
    ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hItemFound = ' & $hItemFound & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

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

    endif

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

    next

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

    next

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

    GUISetState()

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

    While 1;Main Loop
    $msg = GUIGetMsg()
    If $msg = $ok Then
    ; Run("explorer.exe "& _GUICtrlTreeViewGetTree($TreeView,"\"))
    EndIf
    If $msg = $GUI_EVENT_CLOSE Then Exit

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

    WEnd

    [/autoit]


    Vielen Dank im voraus!

    LG fschaef

    Einmal editiert, zuletzt von fschaef (27. Oktober 2012 um 21:46)