Tiger Posted October 22, 2007 Share Posted October 22, 2007 I have to read file 1 and file 2. In file 1 is a list with links and in file 2 is a list with numbers. then i have to read the file 2 and search the numbers in file 1 and then i have to add the link in an array My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 22, 2007 Share Posted October 22, 2007 Ok, so ... what does that mean? You want us to code it for you? SURVEY SAYS!!! BZZZZZZT!!!! Strike one. If you get to three strikes, the Admin family gets a chance to steal! Ok, top 5 answers on the board...when surveyed, 100 forum members said you should ... 1) Do it yourself and then post code when you get stuck for help!!! *good answer*good answer*good answer* SURVEY SAYS!!! DING!!! Number one answer!!! Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Tiger Posted October 22, 2007 Author Share Posted October 22, 2007 The script: #include <Array.au3> #include <File.au3> Local $file_1 Local $file_2 _FileReadToArray(@ScriptDir & "\file_1.txt", $file_1) _FileReadToArray(@ScriptDir & "\file_2.txt", $file_2) For $x = 1 To UBound($file_1) - 1 For $y = 1 To UBound($file_2) - 1 If StringInStr($file_1[$x], $file_2[$y]) Then ; Nothing Else _ArrayDelete($file_1, $x) EndIf Next Next My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
weaponx Posted October 22, 2007 Share Posted October 22, 2007 Dang. I missed out on the Family Feud action. Let me see if I can clarify the problem (?????): File 1 contains links (chain links?, sausage links?, web links with proper html tags?). File 2 contains numbers (integers?, floats?, non-reals?) Now you need to search the links in File 1 for the numbers in File 2, and if no match is found, add it. Help us to help you. Link to comment Share on other sites More sharing options...
zfisherdrums Posted October 22, 2007 Share Posted October 22, 2007 (edited) Hey Tiger, I don't know if this speaks to your issue or not, but running the script gave me a couple of "array out-of-bounds" errors. When the script removes an item from the array, it doesn't necessarily cause the loop to re-evaluate the UBound. Iterating backwards avoids the error. Also, breaking out of the inner loop when the condition is met prevents another "out-of-bounds" error from occurring. Am I using the script inappropriately? #include <Array.au3> #include <File.au3> Local $file_1 Local $file_2 _FileReadToArray(@ScriptDir & "\file_1.txt", $file_1) _FileReadToArray(@ScriptDir & "\file_2.txt", $file_2) For $x = ( UBound($file_1) - 1 ) to 1 step - 1 For $y = ( UBound($file_2) - 1 ) to 1 step - 1 If StringInStr($file_1[$x], $file_2[$y]) Then ; Nothing Else _ArrayDelete($file_1, $x) ExitLoop EndIf Next Next Edited October 22, 2007 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
weaponx Posted October 22, 2007 Share Posted October 22, 2007 zfisherdrums - You will probably get errors if you don't have anything in File1 and File2. Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 22, 2007 Share Posted October 22, 2007 Then add some "If Not IsArray($array) then Exit" error checks. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
zfisherdrums Posted October 22, 2007 Share Posted October 22, 2007 I was initially testing the array comparison algorithm. These are the files I tested with:file_1.txtabcdefg12345file_2.txtacdfg1357 Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... 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