first off, how does file-read loop work and how can I use it in the following situation?
I would like to have the script read each line (unknown number of lines) and input each one as a separate variable using file-read loop and stringsplit (or parse) and then input this data into a listbox so the user can select the numbers (in this case serial numbers) and then click a button to input the data into an edit field.
Code:
loop, read, well_serial_numbers.txt
{
stringsplit, wellserial, ?????
}
Gui, 2: Add, Listbox, x16 y62 w100 h300 0x8 gnumberlistview, %1%|%2%|%3%|[etc. up to 20 or so]
So far I have gotten it to work with FileReadLine but then I would have to know how many lines there were. Also is there a way to input all of the lines as variables into the list box without specifying the variables as %1%|%2%|[etc]?
Here's a slightly shortened version:
Code:
Document_Image_Search:
ArrayCount = 0
Loop, Read, well_serial_numbers.txt
{
ArrayCount += 1
Array%ArrayCount% := A_LoopReadLine
}
FileReadLine, 1, well_serial_numbers.txt, 1
FileReadLine, 2, well_serial_numbers.txt, 2
FileReadLine, 3, well_serial_numbers.txt, 3
FileReadLine, 4, well_serial_numbers.txt, 4
FileReadLine, 5, well_serial_numbers.txt, 5
Gui, 2: Add, GroupBox, x6 y10 w220 h360 , Wells
Gui, 2: Add, Listbox, x16 y62 w100 h300 0x8 gnumberlistview, %1%|%2%|%3%|%4%|%5%
Gui, 2: Add, Button, x116 y30 w100 h40 gsearchbutton1, Search
Gui, 2: Add, Edit, x116 y320 w100 h20 , Add Serial Number
Gui, 2: Add, Button, x116 y340 w90 h20 AddNumberbutton, Add Number
Gui, 2: Add, Button, x260 y90 w110 h30 Logsbutton, Logs
Gui, 2: Add, Button, x260 y130 w110 h30 gWellFilesbutton, Well Files
Gui, 2: Add, GroupBox, x240 y70 w150 h100 , Type of Document
Gui, 2: Add, Button, x260 y310 w110 h40 gNewSearchbutton, New Search
Gui, 2: Add, Text, x116 y280 w100 h30 , Find
Gui, 2: Add, Button, x116 y100 w100 h30 gDeletebutton, Delete
Gui, 2: Add, GroupBox, x240 y200 w150 h80 , Search
Gui, 2: Add, Edit, x250 y230 w44 h0 , Search
Gui, 2: Add, Button, x260 y250 w110 h20 gsearchbutton2, Search
Gui, 2: Add, Edit, x260 y220 w110 h20 , Individual Search
Gui, 2: Add, Button, x246 y12 w150 h30 , Document Image Search Site
Gui, 2: Add, Text, x16 y32 w100 h20 , Number of Wells: %ArrayCount%
Gui, 2: Show, x170 y110 h377 w402, Document Image Search
return