Sign in to follow this  
Followers 0
shaahin

Folder structure in TreeView

3 posts in this topic

hi.

i want to make a program that create a list structure of a drive and all of folders and files in it,then show all of them in a tree view.

i wrote some code that create a list of first level of my drive and all files and folder in it, but i don't now how can do that for all subfolder and files in it. (like dir /s)

sombody can help me?

also i want to save this structure in a file, and next time load it to treeview!

is it difficult?

i am waiting...

my simple code for test :

===============================================

#include <GUIConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#Include <GuiTreeView.au3>
$FileList=_FileListToArray("c:\","*.*",0)
GUICreate("")
GUISetState()
$tview=GUICtrlCreateTreeView(0,0,400,400)
for $i= 1 to $filelist[0]
    $Folder=GUICtrlCreateTreeViewItem($filelist[$i],$tview)
    searchinside("D:\"&$filelist[$i]&"\")       
Next



While 1
     $msg=GUIGetMsg()
    if  $msg=$GUI_EVENT_CLOSE then Exit
WEnd


func searchinside($searchstring)
$FileList2=_FileListToArray($searchstring,"*.*",0)
        if IsArray($filelist2) Then
            for $j=1 to $FileList2[0]
            $Folder2=GUICtrlCreateTreeViewItem($filelist2[$j],$Folder)
            Next    
        EndIf   
EndFunc

Share this post


Link to post
Share on other sites



Are you trying to get it to look like "FileOpenDialog"?... If so, you might take a look at FileGetAttribute(), and get ready for some string parsing fun :lmao:.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I want to make a program to save a drive structure (with all files and folders in all levels) in a text file (and also show it in a treeview) that i can load it later for compare .

I need somthings like 'Folder Bar' in 'My Computer' (Include files).

I can do that for first level of drive, my problem is subfolders and other levels.

Sombody here can help me?

I wrote a simple example (Without Save\Load Function). i Hope it help other to understand what i need.

I am waiting...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0