So, I need some help, what I'm trying to do is read various text files. What I want to do is have a bunch of random text files in the directory, and then autoit will detect every .txt file and store each .txt file in the listview, then the user can select a text file from the list view, and it'll open it and read the lines in it, however, I've hit a snag.
So far, this is what I have:
$text_list = GUICtrlCreateListView("Available Text Files", 20, 50, 210, 150)
$search = FileFindFirstFile("*.txt")
local $file_name[500] = ""
local $file_counter = 0
If $search = -1 Then
GuiCtrlCreateLabel("No patterns found!", 80, 290)
EndIf
While 1
Local $file = FileFindNextFile($search)
If @error Then ExitLoop
$file_name[$file_counter] = GUICtrlCreateListViewItem($file, $text_list)
$file_counter = $file_counter + 1
WEnd
This doesn't quite work though, I'm getting errors with the array.
If I were to do this:
$text_list = GUICtrlCreateListView("Available Text Files", 20, 50, 210, 150)
$search = FileFindFirstFile("*.txt")
If $search = -1 Then
GuiCtrlCreateLabel("No patterns found!", 80, 290)
EndIf
While 1
Local $file = FileFindNextFile($search)
If @error Then ExitLoop
GUICtrlCreateListViewItem($file, $text_list)
$file_counter = $file_counter + 1
WEnd
then it runs fine without error, and displays all the text files in the listview, which is what I want right? I thought I needed a controlID for each listviewitem though, or else how would I know what text file is selected, you know what I mean?
Any help appreciated.