I wanted to get the last lines of a file or string. I searched the forum and found this post by Tuncay.
I adapted it for AHK v2 (with help). As I am some AHK noob, it may not be perfect. I hope it will be useful !
Code: Select all
str_getTail(input_str, last_lines := 1)
{
position := InStr(input_str, "`n",, -1, -last_lines)
If position != 0{
output := SubStr(input_str, position)
output := SubStr(output, InStr(output,"`n") + 1)
}Else
output := input_str
Return output
}