WinActivate("My Application") WinWaitActive("My Application") $file = "C:\Users\Charlie\Desktop\log.txt" ;Log file from where data will be captured $file1 = FileRead($file) Local $a = 0 ;Loop counter variable Do $a += 1 ;Adds 1 to the loop counter Send("INSTANCE " & $a & "{ENTER}") Sleep(1000) ;Waits Until $a = $File1 ;How many times to loop