Shinies Posted December 2, 2005 Share Posted December 2, 2005 Hey, iv been trying to get this to work for ages now, and i cant see why it wont. Heres the contents the text file it scans through. It scans fine, it seems to get the first second and third correctly, but on the last one it doesnt work, it should be: If $Linesplit[3] > "7,000,000" And $Linesplit[4] < "700" but it writes ones with like 1265 and much over 700 to the txt file. 504,450|GDB666|7,043,212|1265 504,450|GDB666|1,043,212|150 504,450|GDB666|2,043,212|1265 504,450|GDB666|4,043,212|2000 504,450|GDB666|10,043,212|400 And here is the script: $File2 = FileOpen("C:\WINDOWS\Desktop\123.txt", 0) $Size = _FileCountLines( "C:\WINDOWS\Desktop\123.txt" ) For $a = 1 To $Size $Line = FileReadLine( $File2, $a ) $LineSplit = StringSplit($Line, '|') If $LineSplit[3] > "7,000,000" And $LineSplit[4] < "700" Then FileWrite( "Results.txt", $LineSplit[2] & " " & $LineSplit[3] & " " & $LineSplit[4] & @CRLF ) EndIf Next FileClose($File2) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 3, 2005 Moderators Share Posted December 3, 2005 I had to use Beta... Kind of a bugger really. #include <file.au3> #include <string.au3> $File2 = FileOpen(@DesktopDir & "\123.txt", 0) $Size = _FileCountLines( @DesktopDir & "\123.txt" ) For $a = 1 To $Size $Line = FileReadLine( $File2, $a ) $LineSplit = StringSplit($Line, '|') If Number(StringRegExpReplace($LineSplit[3], ",", "")) >= '7000000' And Number($LineSplit[4]) <= "700" Then FileWrite( "Results.txt", $LineSplit[2] & " " & $LineSplit[3] & " " & $LineSplit[4] & @CRLF ) EndIf Next FileClose($File2) Hope this helps Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Shinies Posted December 3, 2005 Author Share Posted December 3, 2005 Thanks man that works perfectly! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 3, 2005 Moderators Share Posted December 3, 2005 Good Deal! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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