Sign in to follow this  
Followers 0
Shinies

Need help with this string

4 posts in this topic

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)

Share this post


Link to post
Share on other sites



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 :P


[center]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.[/center]

Share this post


Link to post
Share on other sites

Thanks man that works perfectly!

Share this post


Link to post
Share on other sites

Good Deal! :P


[center]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.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0