I have a text file contains nearly 20 lines wanted to search a string in file and print next 5th line in file using autoit, any one can help me to solve this
#include <File.au3>
#include <array.au3>
$file = @ScriptDir & "\file.txt"
$search = "str"
If FileExists($file) Then
$contents = FileRead($file)
If @error Then
MsgBox(0, 'File Error', $file & ' could not be read.')
Else
For $i = 1 To $count
If StringInStr($contents, $search) Then
MsgBox(0, 'Positive', $file & ' does contain the text "' & $search & '"')
Else
MsgBox(0, 'Negative', $file & ' does NOT contain the text "' & $search & '"')
EndIf
Next
EndIf
EndIf