Guest jhtech Posted June 21, 2005 Share Posted June 21, 2005 I'm working on a script to read each line from a text file and use that line to search another text file for the instance from the first text file. I'm doing a directory listing of two folders and creating the text files. Here is my code that I'm working with.$folder = "D:\iehotfix\rtmgdr"$OutnameHF = "D:\iehotfix.txt"$OutnameSys32 = "D:\system32.txt"#include <file.au3>Dim $test_FileReadToArray($OutnameSys32, $test)$afile = FileOpen($OutnameHF, 0)While 1$read = FileReadLine($afile) If @error = -1 Then ExitLoop For $x = 1 to $test[0] If StringInStr($test, $read) = $read Then MsgBox(0, 'Test', $test & $read) EndIf NextWEnd FileClose($afile)I just want it to post in a message box both instances of the filename being searched for. I can get it to print a . in the message box, but not the name of the file. Thank you for your help in advance.Jeff Link to comment Share on other sites More sharing options...
HardCopy Posted June 21, 2005 Share Posted June 21, 2005 (edited) I'm working on a script to read each line from a text file and use that line to search another text file for the instance from the first text file. I'm doing a directory listing of two folders and creating the text files. Here is my code that I'm working with.$folder = "D:\iehotfix\rtmgdr"$OutnameHF = "D:\iehotfix.txt"$OutnameSys32 = "D:\system32.txt"#include <file.au3>Dim $test_FileReadToArray($OutnameSys32, $test)$afile = FileOpen($OutnameHF, 0)While 1$read = FileReadLine($afile) If @error = -1 Then ExitLoop For $x = 1 to $test[0] If StringInStr($test, $read) = $read Then MsgBox(0, 'Test', $test & $read) EndIf NextWEnd FileClose($afile)I just want it to post in a message box both instances of the filename being searched for. I can get it to print a . in the message box, but not the name of the file. Thank you for your help in advance.Jeff<{POST_SNAPBACK}>I may be wrong but your line:If StringInStr($test, $read) = $read Then *****<---should readIf StringInStr($test, $read) Then do stuff .....The stringinstr command returns either 0=false or the position if found.hthHardCopy Edited June 21, 2005 by HardCopy Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad Link to comment Share on other sites More sharing options...
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