AntiVirusGuy Posted November 27, 2005 Posted November 27, 2005 why cant I search this file for a given string? You can see where I have a line remmed out to test that the file read is working and the string is there. What am I doing wrong? I thought this would be an easy way to check for services using serviwin Help! $file = FileOpen("C:\services.html", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to detect Service") Exit EndIf While 1 $line = FileRead($file,100000) If @error = -1 Then ExitLoop ;MsgBox(0, "Line read:", $line) Wend $result = StringInStr($line,"Windows") MsgBox(0, @error, $result) FileClose($file)
GaryFrost Posted November 27, 2005 Posted November 27, 2005 (edited) $file = FileOpen("C:\services.html", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to detect Service") Exit EndIf $file_lines = "" While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $file_lines = $file_lines & $line & @CRLF ;MsgBox(0, "Line read:", $line) WEnd FileClose($file) $result = StringInStr($file_lines, "Windows") MsgBox(0, @error, $result) or you could do $line = FileRead($file,FileGetSize("C:\services.html")) no need for loop then. Edited November 27, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
AntiVirusGuy Posted November 27, 2005 Author Posted November 27, 2005 Why do you need that $file_lines = "" what does it do???? (other than make it work, thank you)
w0uter Posted November 27, 2005 Posted November 27, 2005 (edited) creates a string witch he adds data to later. Edited November 27, 2005 by w0uter My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now