Wb-FreeKill Posted June 15, 2005 Share Posted June 15, 2005 (edited) The problem is, as you can see in the script, when pressing the first folders in the tree, is writes the path in the Input obove.. but when clicking on subfolders, it should write the new path, including the upper folder - witch it dosen't. How can i possibly retrive the path when browsing trough this tree, ive been working on it for weeks, and can't get any solution at all! expandcollapse popup#include <GUIConstants.au3> #include <GuiListView.au3> Const $LVS_SORTDESCENDING = 0x0020 GUICreate("Treeview Browsing - By FreeKill",750,500) $MainTree = GUICtrlCreateTreeView(1, 60, 250, 417) GUICtrlSetImage(-1,"shell32.dll",3,4) GUICtrlSetImage(-1,"shell32.dll",4,2) $SubTree = GUICtrlCreateListview("Name|Size|Type|Changed",258, 60, 492, 417) _GUICtrlListViewSetColumnWidth($SubTree, 0,190) _GUICtrlListViewSetColumnWidth($SubTree, 1,100) _GUICtrlListViewSetColumnWidth($SubTree, 2,80) _GUICtrlListViewSetColumnWidth($SubTree, 3,100) _GUICtrlListViewJustifyColumn ($SubTree, 1, 1) _GUICtrlListViewJustifyColumn ($SubTree, 3, 0) GUICtrlCreateGroup("",0,53,252,425) $DirInput = GUICtrlCreateInput("C:\",5,10,183,20) $BrowseBtn = GUICtrlCreateButton("Search",193,10,60,21) $CurrentPath = GUICtrlCreateInput(GUICtrlRead($DirInput),5,35,247,20) GUICtrlSetState(-1,$GUI_Disable) $ObjCount = GUICtrlCreateInput("0 Object(s)",0,480,150,20,$ES_READONLY) $SpaceCount = GUICtrlCreateInput("N/A",154,480,596,20,$ES_READONLY) GUISetState() _LoadTree(GUICtrlRead($DirInput), $MainTree,0) While 1;Main Loop $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Case $msg = $BrowseBtn GUICtrlDelete($MainTree) $MainTree = GUICtrlCreateTreeView(1, 60, 250, 417) GUICtrlSetImage(-1,"shell32.dll",3,4) GUICtrlSetImage(-1,"shell32.dll",4,2) GUICtrlSetdata($CurrentPath,GUICtrlRead($DirInput)) _LoadTree(GUICtrlRead($DirInput), $MainTree,0);Path/Tree/State Case $msg > 4 _GUICtrlListViewDeleteAllItems($SubTree) $Read = GUICtrlread($MainTree,1) GUICtrlSetdata($CurrentPath,GUICtrlRead($DirInput) & $Read[0] & "\") _LoadTree(GUICtrlRead($DirInput) & $Read[0] & "\", $SubTree,1);Path/Tree/State GUICtrlSetdata($ObjCount,_GUICtrlListViewGetItemCount($SubTree) & " Object(s)") $TheSize = DirGetSize(GUICtrlRead($Currentpath)) / 1024 / 1024 $FreeSpace = DriveSpaceFree(Stringleft(GUICtrlRead($DirInput),3))/ 1024 GUICtrlSetdata($SpaceCount,Stringleft($TheSize,Stringinstr($TheSize,".")+2) & " MB (Free Space: "& StringLeft($FreeSpace,StringInStr($FreeSpace,".")+1) & " GB)") EndSelect Wend;Mainloop end ; Functions ;//////////////////////////////////////////// Func _LoadTree($sRoot, $hParent, $GetFiles) Local $ThePath = GUICtrlRead($CurrentPath) Local $sMask = "*.*" Local $aFile[1], $nCnt = 1, $newParent Local $hSearch = FileFindFirstFile($sRoot & $sMask) If $hSearch >= 0 Then $sFile = FileFindNextFile($hSearch) While not @error ReDim $aFile[$nCnt] $aFile[$nCnt-1] = $sFile $nCnt = $nCnt + 1 $sFile = FileFindNextFile($hSearch) Wend FileClose($hSearch) EndIf For $i = 0 To UBound($aFile) - 1 If $aFile[$i] == "." or $aFile[$i] == ".." Then ContinueLoop If $GetFiles = 0 Then;Do not include files If StringInStr(FileGetAttrib($sRoot & "\" & $aFile[$i]), "D") Then $newParent = GUICtrlCreateTreeViewItem($aFile[$i], $hParent) _LoadTree($sRoot & $aFile[$i] & "\", $newParent,0);Keep search trough folders ContinueLoop Endif ElseIf $GetFiles = 1 Then;Include Files $FilegetSize = Round(FileGetSize($ThePath & $aFile[$i]) / 1024,0) $Time = FileGetTime($ThePath & $aFile[$i], 1) If Not @Error Then $yyyymd = $Time[2] & "." & $Time[1] & "." & $Time[0] & " " & $Time[3] & ":" & $Time[4] If StringInStr(FileGetAttrib($sRoot & "\" & $aFile[$i]), "D") Then $SnewParent = GUICtrlCreateListViewItem($aFile[$i] &"||"& _FileGetType($ThePath & $aFile[$i]) &"|"& $yyyymd, $hParent) ContinueLoop Endif GUICtrlCreateListViewItem($aFile[$i] &"|"& $FilegetSize & " KB" &"|"& _FileGetType($ThePath & $aFile[$i]) &"|"& $yyyymd, $hParent);Include files EndIf EndIf Next EndFunc Func _FileGetExt($sFileName) Dim $DotPos, $Other $DotPos = StringInStr($sFileName, '.', 1, -1) If $DotPos = 0 Then Return '' $Other = StringInStr($sFileName, '\', 1, -1) If $Other > $DotPos Then Return '' $Other = StringInStr($sFileName, ':', 1, -1) If $Other > $DotPos Then Return '' Return StringTrimLeft($sFileName, $DotPos) EndFunc Func _FileGetType($sFileName) Dim $Type If StringInStr(FileGetAttrib($sFileName),"D") Then $Type = RegRead('HKEY_CLASSES_ROOT\Folder', '') Else Dim $Ext = _FileGetExt($sFileName) $Type = RegRead('HKEY_CLASSES_ROOT\.' & $Ext, '') If $Type = '' Then $Type = $Ext & '-file' Else Dim $Type2 = RegRead('HKEY_CLASSES_ROOT\' & $Type, '') If $Type2 <> '' Then $Type = $Type2 EndIf EndIf Return $Type EndFunc Edited June 15, 2005 by Wb-FreeKill Link to comment Share on other sites More sharing options...
GaryFrost Posted June 17, 2005 Share Posted June 17, 2005 If I could get the handle for the item, I could help you, but haven't had any luck. 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 More sharing options...
Wb-FreeKill Posted June 17, 2005 Author Share Posted June 17, 2005 If I could get the handle for the item, I could help you, but haven't had any luck.<{POST_SNAPBACK}>hmm it has to be possible somehow?.. haven't had any luck yet too Link to comment Share on other sites More sharing options...
GaryFrost Posted June 17, 2005 Share Posted June 17, 2005 (edited) hmm it has to be possible somehow?.. haven't had any luck yet too<{POST_SNAPBACK}>Now you understand why I haven't written any UDF's for Treeview, can't get any of the functions to work with items.Edit: Probably something that needs to be taken up with Holger Edited June 17, 2005 by gafrost 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 More sharing options...
Wb-FreeKill Posted June 17, 2005 Author Share Posted June 17, 2005 Now you understand why I haven't written any UDF's for Treeview, can't get any of the functions to work with items.Edit: Probably something that needs to be taken up with Holger<{POST_SNAPBACK}>Think your right, i have the idea that Holger know something about Treeview we others don't Link to comment Share on other sites More sharing options...
Holger Posted June 17, 2005 Share Posted June 17, 2005 (edited) Found a possibility Make some tests now (uses DllCall and DllStrucCreate - things from current beta).Until later...HolgerEdit put a small sample in the script-area.Maybe you can use it or parts for your script. Will now again watching "Twister" on DVD... Edited June 17, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted June 17, 2005 Author Share Posted June 17, 2005 Found a possibility Make some tests now (uses DllCall and DllStrucCreate - things from current beta).Until later...Holger<{POST_SNAPBACK}>Very nice Holger... preciate it! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now