Jump to content
Sign in to follow this  
friends

How to read such file ?

Recommended Posts

friends

Well, I wonder how to read such file with AutoIT3 ?

Below show example is only 1 record.

10067465      MIS Department  9005S40011       

as the record keep appending one after another, how can I perform

a FileRead() to actually get the data I wanted ?

The above example, the data I need is 7465 (after 1006),

9005 (before S) and 1 (after 4001) which is a check digit.

Kindly see the attached file, it looks "complex" to me !

Hope you can help me up with this by providing a working file.

Big thanks...

cashier.txt

Share this post


Link to post
Share on other sites
Def

Try the StringTrimLeft() function.

"Returns the string trimmed by count characters from the left"

so:

$file = FileOpen("cashier.txt", 0)

While 1

$result = FileReadLine($file)

If @error = -1 Then ExitLoop

$splitResult = StringSplit($result, " ") ;should be able to combine this and the FileReadLine line above

$trimmedResult = StringTrimLeft($splitResult[1], 4) ;chop off first 4 chars

WEnd

Haven't tested this at all.

Def

Edited by Def

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.