Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

searching for a phrase in a txt file

$
0
0

hi, this is probably a noob question but i did write a script to search for a text in a .txt file but it seems to be not working and i cant seem to figure out why any help would be appretiated

 
#include <File.au3>
Dim $array
 
$file = @ScriptDir & '\DEBUG.log.txt'
$find = 'Unable to Log in: Invalid Login or PIN'
 
If $file <> '' Then
_FileReadToArray($file, $array)
For $i = 1 To UBound($array) - 1
if StringInStr($array[$i], $find) Then
MsgBox(64, 'Failed', 'Login Failed')
Else
MsgBox(64, 'Passed','Login Succesfull')
EndIf
Next
Else
MsgBox(64, 'Failed','Empty file')
EndIf
 
the file contains the $find phrase but the script still returns Login Succesfull and it turns it into an infinite loop.
 

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>