Hallou :D, ich versuche schon seit gestern (wow lange Zeit) ein Programm zu schreiben, welches mir alle unterordner und ordner in einem TreeView anzeigt. Als ListBox habe ich das ganze schon gelöst gehabt, sah aber dann doch etwas "kacke" aus.
Mein Code sieht immo so aus :
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <GuiTreeView.au3>
Global $Pic1
$operations = 0
$TempFolder=""
$folderinfile=""
$ViewList=""
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Anime Sammlung", 615, 438, 192, 124)
;;$List1 = GUICtrlCreateList("", 8, 8, 153, 409)
$Open = GUICtrlCreateButton("Ordner öffnen", 528, 392, 75, 25)
$Label1 = GUICtrlCreateLabel("", 180, 0, 700, 51)
GUICtrlSetFont(-1, 20, 100, 0, "Segoe Print")
$TreeView = _GUICtrlTreeView_Create($Form1,8, 8, 175, 409)
;$TreeView1 = GUICtrlCreateTreeView(8, 8, 175, 409)
$naru = _GUICtrlTreeView_Add($TreeView,"","Naruto")
_GUICtrlTreeView_AddChild($TreeView,$naru,"Shippuuden")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$Listnames = _FileListToArray(@ScriptDir&"Anime")
[/autoit] [autoit][/autoit] [autoit]$desktopini =_ArraySearch($Listnames,"desktop.ini")
[/autoit] [autoit][/autoit] [autoit]For $a=0 to $Listnames[0] step 1
if $Listnames[$a]="desktop.ini" then
$operations+=1
_ArrayDelete($Listnames,$desktopini)
$Listnames[0] = $Listnames[0]-$operations
ExitLoop
EndIf
next
For $dir=1 to $Listnames[0] step 1
$TempFolder=_FileListToArray(@ScriptDir&"Anime"&$Listnames[$dir]&_FileListToArray(@ScriptDir&"Anime"&$Listnames[$dir]))
For $dirin = 1 to $TempFolder[0] step 1
if FileGetAttrib(@ScriptDir&"Anime"&$Listnames[$dir]&""&$TempFolder[$dirin]) = "D" Then
_ArrayAdd($Listnames,$Listnames[$dir]&""&$TempFolder[$dirin])
$Listnames[0]+=1
EndIf
Next
Next
For $ordner=1 to $Listnames[0] step 1
if FileGetAttrib($TempFolder=_FileListToArray(@ScriptDir&"Anime"&$Listnames[$ordner]))="D" Then
MsgBox("","",$TempFolder[$ordner])
EndIf
Next
For $i=1 to $Listnames[0] step 1
if StringInStr("Apple","Apple") Then
;MsgBox("","",$Listnames[$i])
EndIf
If StringInStr($Listnames[$i],$Listnames[$i]&"") Then MsgBox("","",_GetListName($Listnames,1))
_GUICtrlTreeView_Add($TreeView,"",$Listnames[$i])
Next
while 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Open
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]EndSwitch
WEnd
Ich wollte fragen, wie ich das am besten Löse wenn ich :
Einen Order habe der bspw. "Naruto" heißt, (im array als Naruto) und 2 unterordner "Naruto" & "Shippuuden"(Im array Naruto\Naruto & Naruto\Shippuuden).
eine Lösung wäre
[autoit]StringInStr()
[/autoit]aber ich weiß nicht wie genau ich das so einstetzen soll. Und ob das so wie ich das Programmiert habe überhaupt gehen würde.