#NoTrayIcon FileToRead = dummy.txt if %0% > 0 { FileToRead = %1% } AutoTrim, On FileRead, AllLines, %FileToRead% if not ErrorLevel { Total = 0 Loop, parse, AllLines, `n { LineNr%A_Index% = %A_LoopField% Total = %A_Index% } Random, randomLine, 1, Total MsgBox % LineNr%randomLine% } return