Jump to content

christarp

Members
  • Posts

    6
  • Joined

  • Last visited

christarp's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Oh wow, well, I feel stupid.
  2. Ok, back at this, hit a snag, but it makes no sense to me really. $file_name = (_GUICtrlListView_GetItemText($hText_List, _GUICtrlListView_GetSelectedIndices($hText_List)) & @LF) $opened_file = FileOpen($file_name) If $opened_file = -1 Then MsgBox(0, "Error", "Unable to open "&$file_name) EndIf gives me an error, but.. $file_name = (_GUICtrlListView_GetItemText($hText_List, _GUICtrlListView_GetSelectedIndices($hText_List)) & @LF) $opened_file = FileOpen("stuff.txt") If $opened_file = -1 Then MsgBox(0, "Error", "Unable to open "&$file_name) EndIf runs fine? Note: it appears as though both versions say "stuff.txt", and the file most definitely exists. Is there a difference between them that I can't see? Does fileOpen not allow a variable to be in the function?
  3. 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.
  4. my goodness thank you, I had been looking in the documentation for something like the & operator and I didn't find it. thanks a bunch haha.
  5. So lets say I have two variables, one is a name, and one is a number. so string and integer, now I want to be able to use these two variables as a row in a list view item. The best way I have found to do this is using one variable in the list view item. So basically I have a variable containing a string like "chris" and then i have another variable containing lets say the number 5, I need to put these in to one variable containing a string that says "chris|5" so I can use it in a list view item, because I have not found a way to use two variables in a list view item. Any help would be appreciated.
×
×
  • Create New...