Code: Select all
file = C:\file.txt
Loop, Read, %file%
line_count := A_Index ;gathers the total number of lines in the text file and ultimately gives you the last number
current_line = %line_count% ;sets the current line to the last line number
Loop,
{
FileReadLine, string, %file%, %current_line%
MsgBox, Line %current_line% contains:`n%string%
current_line := current_line - 1 ;subtracts one line from the current line so that the next time it will read the line above the current line
If current_line = 0
{
break ;once there are no more lines left in the file, stop looping the file
}
}