Touch Posted June 16, 2008 Posted June 16, 2008 Hiya, For sometime now I have been trying to make a program to search through files/folders and display them in a listbox. Here is my GUI: #include <GUIConstants.au3> Global $Index = @ScriptDir & '\index.ini' ; Index file $GUI = GUICreate("GUI", 378, 249, -1, -1) GUICtrlCreateLabel("Query:", 8, 8, 35, 17) $Cast = GUICtrlCreateCombo("", 48, 8, 321, 25) $Files = GUICtrlCreateList("", 8, 40, 361, 201) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd But that's as far as I can get. From the AutoIt I understand I will need to, put all the files and folders in an array and then as the search query is typed, select the files/folders and list them. However I do not know how to go about it. I really would like to do this. Thanks, Touch. [center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center]
James Posted June 16, 2008 Posted June 16, 2008 (edited) Here is something I found in the GUI section, with help of Martin and I forgot his name:expandcollapse popup#include <GUIConstants.au3> Global $_Index, $Data = '', $Split = StringSplit($Data, "|"), $savetext Dim $buffer Index() Opt("GUIDataSeparatorChar", "|") $split = StringSplit($data, "|") $GUI = GUICreate("GUI", 378, 265, -1, -1) GUICtrlCreateLabel("Query:", 8, 8, 35, 17) $input = GUICtrlCreateInput("", 48, 8, 321, 25) $list = GUICtrlCreateList("", 8, 40, 361, 201) GUICtrlSetData(-1, $Data) $Case = GUICtrlCreateCheckbox("Case Sensitive", 10, 242) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If GUICtrlRead($input) <> "" Then Search() Do $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case Else ;;; EndSelect Until GUICtrlRead($input) <> $savetext If GUICtrlRead($input) = "" Then GUICtrlSetData($list, "") GUICtrlSetData($list, $data) EndIf EndIf WEnd Func Index() $Folder = @ScriptDir $Search = FileFindFirstFile($Folder & '\*.*') While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop $Attr = FileGetAttrib($File) If Not @error And StringInStr($Attr, 'D') = 0 Then $Data = $Data & '|' & $File EndIf WEnd FileClose($Search) $Data = StringLeft($Data, StringLen($Data) - 1);remove last separator $Data = StringRight($Data, StringLen($Data) - 1);remove first separator ConsoleWrite($Data & @CRLF); Debug Data (Output) EndFunc ;==>Index Func Search() $savetext = GUICtrlRead($input) For $i = 1 To $Split[0] If GUICtrlRead($Case) = $GUI_CHECKED Then If StringLeft($Split[$i], StringLen(GUICtrlRead($input))) == $savetext Then $buffer &= $Split[$i] & "|" EndIf Else If StringLower(StringLeft($Split[$i], StringLen(GUICtrlRead($input)))) == StringLower($savetext) Then $buffer &= $Split[$i] & "|" EndIf EndIf Next $buffer = StringTrimRight($buffer, 1) GUICtrlSetData($list, "") GUICtrlSetData($list, $buffer) $buffer = "" EndFunc ;==>SearchEdit: I changed some code, the GUI and added functions to do the work. Edited June 16, 2008 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Touch Posted June 16, 2008 Author Posted June 16, 2008 Here is something I found in the GUI section, with help of Martin and I forgot his name:SNIPThanks James but I need to be able to look through all files and folders, sort of like neoSearch. [center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center]
Kiti Posted June 16, 2008 Posted June 16, 2008 Thanks James but I need to be able to look through all files and folders, sort of like neoSearch.Make a script wich runs this in cmd "cd C:\" and then "dir /s /b >list.txt" so it will create a list of allll files in the C drive. Then you can easily navigate through them. Pls tell me if it was helpful Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30
monoceres Posted June 16, 2008 Posted June 16, 2008 Thanks James but I need to be able to look through all files and folders, sort of like neoSearch.Here's something to read: http://www.autoitscript.com/forum/index.ph...c=58558&hl= Broken link? PM me and I'll send you the file!
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