#include <guiconstants.au3>
#include <array.au3>
#include <WindowsConstants.au3>
#include <TreeViewConstants.au3>
#Include <File.au3>
#Include <GUIConstantsEx.au3>
#Include <GUIImageList.au3>
#Include <GUITreeView.au3>
Global $items[1], $names[1]
$Main = GUICreate("Каталог", 340, 300, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_GROUP, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))
$Tree = GUICtrlCreateTreeView(5, 10, 70, 280, -1, $WS_EX_CLIENTEDGE + $TVS_SINGLEEXPAND)
$StartDir = @ScriptDir
$TrreView = GUICtrlCreateTreeViewItem("Каталог", $Tree)
MakeList($StartDir, $TrreView, 0)
MakeList($StartDir, $TrreView, 1)
GUISetState(@SW_SHOW)
GUISetState(@SW_MAXIMIZE)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case Else
for $i = 1 to ubound($items) - 1
if $msg = $items[$i] then ishidden($names[$i])
Next
sleep(20)
EndSwitch
WEnd
Func MakeList($dir, $parent, $mode = 0)
FileChangeDir($dir)
$search = FileFindFirstFile("*.*")
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
$GetExt = GetExt($dir & "\" & $file)
If $GetExt <> "folder" And $mode = 1 Then
$buffer = BinaryToString($file)
_ArrayAdd($items, GUICtrlCreateTreeViewItem($buffer,$parent))
_ArrayAdd($names, @workingdir & "\" & $file)
GUICtrlSetColor($items[Ubound($items) - 1], 0xff8800)
Else
If $GetExt = "folder" And $mode = 0 Then
$buffer = BinaryToString($file)
_ArrayAdd($items, GUICtrlCreateTreeViewItem($buffer,$parent))
_ArrayAdd($names, @workingdir & "\" & $file)
GUICtrlSetColor($items[Ubound($items) - 1], 0xffcc00)
MakeList($dir & "\" & $file, $items[Ubound($items) - 1], 0)
MakeList($dir & "\" & $file, $items[Ubound($items) - 1], 1)
EndIf
EndIf
WEnd
FileClose($search)
EndFunc
Func GetExt($file)
If StringInStr(FileGetAttrib($file), "D") Then Return "folder"
Return StringUpper(StringTrimLeft($file, StringInStr($file, ".", 0, -1)))
EndFunc
Func ishidden($file)
msgbox(0,"",$file)
EndFunc