Jump to content

Custom, Embedded FileSelectFolder()


Recommended Posts

FileSelectFolder opens a treeview list of your desktop/harddrive and all the files etc, except in a window. (my friend) needs this to be embedded into his window which I've been attempting for awhile. This is what I have so far... but its nothing very special atm... just testing treeview (never used it before lol)

#include <GUIConstants.au3>
#include <Array.au3>
#Include <GuiTreeView.au3>
Opt("MustDeclareVars", 1)
Opt("GUIDataSeparatorChar", "\")
Dim $folder, $file, $temp, $treeview, $drivec, $treeviewitemfolder, $treeviewitemfile, $test1, $test2, $msg
GUICreate("My Window",512,512)
$folder = FileFindFirstFile("C:\*.?")
$file = FileFindFirstFile("C:\*.?**")
$temp = 0
GUICreate("Treeview Sample",512,512)
$treeview = GUICtrlCreateTreeView(10,10,482,482)
$DriveC = GUICtrlCreateTreeViewItem("C:\",$Treeview)
GUICtrlSetImage(-1, "shell32.dll", 3, 4)
GUICtrlSetImage(-1, "shell32.dll", 4, 2)
GUICtrlSetColor(-1, 0x0000FF)
Dim $treeviewitemFolder[1]
Dim $treeviewitemFile[1]
While 1
    $test1 = FileFindNextFile($folder)
    If @error Then ExitLoop
    If $test1 <> "" Then
        If Not @error  Then 
            $TreeviewItemFolder[$temp] = GUICtrlCreateTreeViewItem($test1,$DriveC)
            _GUICtrlTreeViewSetIcon($DriveC, $TreeviewItemFolder[$temp], "shell32.dll", 17,2)
    GUICtrlSetColor(-1, 0x000088)
    $temp = $temp + 1
$temp = 0
While 1
    $test2 = FileFindNextFile($file)
    If @error Then ExitLoop
    If $test2 <> "" Then
        If Not @error  Then 
            If Not @error AND $test2 <> "" Then $TreeviewItemFile[$temp] = GUICtrlCreateTreeViewItem($test2,$DriveC)

;~ Dim $path[$temp]
;~ For $i = 0 to $temp -1
;~  $test1 = FileFindNextFile($test)
;~  If @error Then ExitLoop
;~  $path[$i] = GUICtrlCreateTreeViewItem($test1,$Treeview)
;~ Next

While 1
    $msg = GUIGetMsg()
        Case $msg = $GUI_EVENT_CLOSE

It does list all the first directory folders and files, and a few that... that appear there (maybe hidden). The folders are supposed to be dark blue with files being default black (Until the icons work)

Anyways, the icons wont change.. And the $file lists the folders too. I dont know what (if any) extension folders use, so the 'wildcards' dont really help ...

Also, Ive been trying to make the icons able to change but for some reason they wont! The helpfile for these UDF's are terrible, they dont explain whats going on very well and the examples use like all the UDF's in that category, so its hard to tell whats doing what

~~Once I get this icon and the folder/file seperation working it feels like this could be pretty easy to make it do the entire harddrive in a few loops... cant wait to test that lol

Edited by Rad
Link to comment
Share on other sites

uhh it says you need beta

where do you get that? its not under the downloads\beta\autoit3 here http://www.autoitscript.com/autoit3/files/beta/autoit/


and no it does not work (at all) it says the first variable cant be re-defined (wtf?...)

Just make sure you have the latest release version

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.


Link to comment
Share on other sites

Look at the date. It's almost one year old. Just try to run it with the latest version of

AutoIt, which isn't beta anymore.

It says that the variable cannot be redefined because it's already assigned in one of

the included files. Just remove those lines from Holger's script and you will not hear

AutoIt complain about those anymore.

Also, you should replace any DllStructDelete($var) with $var = 0.

It just might work now...

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...