BananaFredSoft Posted September 4, 2007 Share Posted September 4, 2007 (edited) This is a simple file search program. You can choose which folder to index, and then add more folders to the index easily.Suggestions/comments/criticism appreciated Update 10-6-07: Added Update Index and some other stuff _FileListToArrayNew2g.au3 downloadexpandcollapse popup#include <File.au3> #include <Array.au3> #include <_FileListToArrayNew2g.au3> #include <GUIConstants.au3> #include <IE.au3> #include <GuiListView.au3> Opt("TrayAutoPause", 0) Opt("RunErrorsFatal", 0) $tsearch = TrayCreateItem("Search") $im = TrayCreateMenu("Indexing") $tindex = TrayCreateItem("Add folder to index", $im) $tdeleteindex = TrayCreateItem("Delete index", $im) $treindex = TrayCreateItem("Re-Index", $im) $Buttonrefine = "null" HotKeySet("^!s", "Search") $searcharray = _ArrayCreate(0) $file = _ArrayCreate("") _FileReadToArray(@ScriptDir & "\FileList.data", $file) If FileExists(@ScriptDir & "\FileList.data") = 0 Then $time = TimerInit() $textfile = FileOpen(@ScriptDir & "\FileList.data", 0 + 2) $dirtoindex = FileSelectFolder("Select folder to index", "") $file = _FileListToArray3($dirtoindex, "*", 1, 1) For $i = 1 To $file[0] FileWriteLine($textfile, $file[$i]) Next IniWrite(@ScriptDir & "\FileList2.data", "Indexed Folders", IniRead(@ScriptDir & "\FileList2.data", "Indexed Folders", "NUM", 0) + 1, $dirtoindex) IniWrite(@ScriptDir & "\FileList2.data", "Indexed Folders", "NUM", IniRead(@ScriptDir & "\FileList2.data", "Indexed Folders", "NUM", 0) + 1) $time = TimerDiff($time) MsgBox(0, "Indexing", "Indexing complete. " & $file[0] & " files were indexed. Indexing took " & Round($time / 1000) & " seconds.") If MsgBox(4, "Run on startup", "Would you like BananaSearch to run on logon?") = 6 Then FileCreateShortcut(@ScriptFullPath, @StartupDir & "\BananaSearch.lnk") EndIf $file = _ArrayCreate("") _FileReadToArray(@ScriptDir & "\FileList.data", $file) EndIf While 1 $t = TrayGetMsg() If $t = $tsearch Then Search() ElseIf $t = $tindex Then $time = TimerInit() $textfile = FileOpen(@ScriptDir & "\FileList.data", 0 + 1) $dirtoindex = FileSelectFolder("Select folder to index", "") $file = _FileListToArray3($dirtoindex, "*", 1, 1) For $i = 1 To $file[0] FileWriteLine($textfile, $file[$i]) Next IniWrite(@ScriptDir & "\FileList2.data", "Indexed Folders", IniRead(@ScriptDir & "\FileList2.data", "Indexed Folders", "NUM", 0) + 1, $dirtoindex) IniWrite(@ScriptDir & "\FileList2.data", "Indexed Folders", "NUM", IniRead(@ScriptDir & "\FileList2.data", "Indexed Folders", "NUM", 0) + 1) $time = TimerDiff($time) MsgBox(0, "Indexing", "Indexing complete. " & $file[0] & " files were indexed. Indexing took " & Round($time / 1000) & " seconds.") $file = _ArrayCreate("") _FileReadToArray(@ScriptDir & "\FileList.data", $file) ElseIf $t = $tdeleteindex Then If MsgBox(4, "Delete Index", "Would you like to delete your index?") = 6 Then FileDelete(@ScriptDir & "\FileList.data") MsgBox(0, "Delete Index", "Index deleted.") EndIf ElseIf $t = $treindex Then If MsgBox(4, "Re-index", "Would you like to update the index of the folders you had indexed before?") = 6 Then FileDelete(@ScriptDir & "\FileList.data") $time = TimerInit() $textfile = FileOpen(@ScriptDir & "\FileList.data", 0 + 2) For $h = 1 To IniRead(@ScriptDir & "\FileList2.data", "Indexed Folders", "NUM", 0) $dirtoindex = IniRead(@ScriptDir & "\FileList2.data", "Indexed Folders", $h, "") $file = _FileListToArray3($dirtoindex, "*", 1, 1) For $i = 1 To $file[0] FileWriteLine($textfile, $file[$i]) Next Next $time = TimerDiff($time) MsgBox(0, "Indexing", "Index update complete. " & $file[0] & " files were indexed. Indexing took " & Round($time / 1000) & " seconds.") $file = _ArrayCreate("") _FileReadToArray(@ScriptDir & "\FileList.data", $file) EndIf EndIf WEnd Func Search () $searcharray = _ArrayCreate(0) $search = InputBox("Search", "Search for a file.") $time2 = TimerInit() For $i = 1 To $file[0] If StringInStr($file[$i], $search) Then _ArrayAdd($searcharray, $file[$i]) $searcharray[0] += 1 EndIf Next #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Results", 444, 426, 193, 115, $WS_SIZEBOX + $WS_MINIMIZEBOX) $ListView1 = GUICtrlCreateListView("", 8, 8, 425, 297) GUICtrlSetResizing(-1, 3) _GUICtrlListViewInsertColumn($ListView1, 0, "File", 0, 415) GUICtrlSetResizing(-1, 1) For $i = 1 To $searcharray[0] GUICtrlCreateListViewItem($searcharray[$i], $ListView1) Next $Button1 = GUICtrlCreateButton("Go!", 8, 312, 100, 17, 0) $Button2 = GUICtrlCreateButton("Navigate", 120, 312, 100, 17, 0) $refine = GUICtrlCreateButton("Refine Search", 240, 312, 100, 17, 0) $size = GUICtrlCreateLabel("", 20, 339, 300) $searchtime = GUICtrlCreateLabel(Round(TimerDiff($time2) / 1000, 2) & " seconds", 20, 359, 200) $filenumber = GUICtrlCreateLabel($searcharray[0] & " results.", 20, 379, 200) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $now = "" While 1 $nMsg = GUIGetMsg(1) Switch $nMsg[0] Case 0 Case $GUI_EVENT_CLOSE If $nMsg[1] = $Form1 Then GUIDelete($Form1) ExitLoop Else GUIDelete($nMsg[1]) EndIf Case $refine #Region ### START Koda GUI section ### Form= $Formrefine = GUICreate("Refine Search", 502, 121, 193, 115) $Label1 = GUICtrlCreateLabel("Search:", 8, 10, 41, 17) $Label2 = GUICtrlCreateLabel("Directory to search in:", 8, 35, 107, 17) $Input1 = GUICtrlCreateInput($search, 56, 8, 441, 21) $Input2 = GUICtrlCreateInput("", 120, 32, 377, 21) $Label3 = GUICtrlCreateLabel("Exclude:", 8, 58, 45, 17) $Input3 = GUICtrlCreateInput("", 56, 56, 441, 21) $Buttonrefine = GUICtrlCreateButton("Search", 8, 88, 489, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Case $Button1 ShellExecute(StringReplace(GUICtrlRead(GUICtrlRead($ListView1)), "|", "")) Case $Button2 _IECreate(getdir(GUICtrlRead(GUICtrlRead($ListView1)))) Case $Buttonrefine _GUICtrlListViewDeleteAllItems($ListView1) $searcharray = _ArrayCreate(0) $time2 = TimerInit() For $i = 1 To $file[0] If BitAND(StringInStr($file[$i], GUICtrlRead($Input1)), StringInStr($file[$i], GUICtrlRead($Input3)) = 0, StringLeft($file[$i], StringLen(GUICtrlRead($Input2))) = GUICtrlRead($Input2)) Then _ArrayAdd($searcharray, $file[$i]) $searcharray[0] += 1 GUICtrlCreateListViewItem($file[$i], $ListView1) EndIf Next GUICtrlSetData($searchtime, Round(TimerDiff($time2) / 1000, 2) & " seconds") GUICtrlSetData($filenumber, $searcharray[0] & " results.") GUIDelete($Formrefine) EndSwitch If GUICtrlRead($ListView1) <> $now Then GUICtrlSetData($size, FileGetSize(StringReplace(GUICtrlRead(GUICtrlRead($ListView1)), "|", "")) & " bytes") $now = GUICtrlRead($ListView1) EndIf WEnd EndFunc ;==>Search Func getdir($filename) $split = StringSplit($filename, "\") If Not @error Then $dir = "" $num = 1 Do $dir &= $split[$num] & "\" $num += 1 Until $num = $split[0] Return $dir EndIf Return 0 EndFunc ;==>getdir Edited October 6, 2007 by BananaFredSoft -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
gseller Posted September 4, 2007 Share Posted September 4, 2007 Cool, That's pretty nice! Link to comment Share on other sites More sharing options...
ptrex Posted September 4, 2007 Share Posted September 4, 2007 @BananaFredSoftI think that it's better to use what is already there on the system, rather than to reinvent the wheel. MS Indexing ServiceThis functionality will not only index the names of but also the content.regards,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
gseller Posted September 4, 2007 Share Posted September 4, 2007 Espesially when MS has done such a fine job of it already. Nice work *** Braces himself for thr MS Hater comments *** Link to comment Share on other sites More sharing options...
BananaFredSoft Posted September 4, 2007 Author Share Posted September 4, 2007 @BananaFredSoftI think that it's better to use what is already there on the system, rather than to reinvent the wheel. MS Indexing ServiceThis functionality will not only index the names of but also the content.regards,ptrexI can always try, can't I? -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
BananaFredSoft Posted September 4, 2007 Author Share Posted September 4, 2007 New update! -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
sebastian111 Posted October 4, 2007 Share Posted October 4, 2007 How do you use this ? I try to build and after I started the .exe.. but nothing happens. Also, it has some UI ? And some options when and how to make the index ? Link to comment Share on other sites More sharing options...
JustinReno Posted October 4, 2007 Share Posted October 4, 2007 I think its nice! I'm not against MS but making a much smaller, maybe even better version of there search is good! Link to comment Share on other sites More sharing options...
BananaFredSoft Posted October 6, 2007 Author Share Posted October 6, 2007 How do you use this ? I try to build and after I started the .exe.. but nothing happens.Also, it has some UI ? And some options when and how to make the index ?New update!I hope it works better for you. -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
YOUF Posted May 23, 2008 Share Posted May 23, 2008 _FileListToArrayNew2g.au3 download Sorry, some required files are missing, if you intended to view a topic, it's possible that it's been moved or deleted. Please go back and try again. Link to comment Share on other sites More sharing options...
BananaFredSoft Posted May 23, 2008 Author Share Posted May 23, 2008 Where did the file go??? That's really wierd! -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted October 10, 2008 Share Posted October 10, 2008 Where did the file go??? That's really wierd!Forum probably burped. Could you re-upload it? Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
jerem488 Posted November 17, 2008 Share Posted November 17, 2008 we can't download _FileListToArrayNew2g.au3 Qui ose gagneWho Dares Win[left]CyberExploit[/left] 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