Jump to content

How to read such file ?


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...