Search the Community
Showing results for tags 'string search slow'.
-
i have a file with 36105 lines to search for a string. enough said. it takes too long to find a string given, so #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <File.au3> #Include <GuiListView.au3> FileInstall ("Bibles\Russian.txt","Russian.txt",1) $MainGUI = GUICreate ("Bible Search",400,435) GUICtrlCreateGroup ("Search ?",5,5,390,45) $Input = GUICtrlCreateInput ("",10,20,300,20) $SearchButton = GUICtrlCreateButton ("Go !",315,20,70,20) GUICtrlCreateGroup ("Results.",5,50,390,325) $ListView = GUICtrlCreateListView ("Results of your search displayed here.|",10,65,380,300) _GUICtrlListView_SetColumnWidth ($ListView,0,375) $ShowButton = GUICtrlCreateButton ("Show Selected.",5,380,395,30) $Status = GUICtrlCreateLabel ("Whats going on ?",5,420,390,20) GUISetState (@SW_SHOW,$MainGUI) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then FileDelete ("Russian.txt") Exit EndIf If $msg = $SearchButton Then $SearchFor = GUICtrlRead ($Input) _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView)) For $i = 1 to 36105 GUICtrlSetData ($Status,"Whats going on ? Working") $SearchIn = FileReadLine ("Russian.txt",$i) If StringInStr ($SearchIn,$SearchFor) <> @error Then GUICtrlCreateListViewItem ($SearchIn,$ListView) EndIf $Loopmsg = GUIGetMsg() If $Loopmsg = $SearchButton Then MsgBox(0,'','search stoped') ExitLoop EndIf Next GUICtrlSetData ($Status,"Whats going on ? Nothing") EndIf If $msg = $ShowButton Then MsgBox(0,'',GUICtrlRead (GUICtrlRead ($ListView))) EndIf WEnd as simple as i could yet its too long. Is there a way to search faster ? I noticed searching for a whole phrase takes just as long as it takes to find a word in this phrase
- 23 replies
-
- bible
- string search slow
-
(and 1 more)
Tagged with: