Set a variable(for example: Read_Line) to 1, read line $Read_Line, variable+1……
https://wiki.keyboardmaestro.com/action/If_Then_Else
For more information, see the wiki Searching the Forum for Answers section.