Jump to content

Opening and parsing a sequential file.


Recommended Posts

Good afternoon to everybody.

I apologize for my poor english. I'writing from Italy....

I'm just a new visitor (user, maybe).

So.... the question in the title; mayby the answer already exists.. then thanks the those that will address myself to it.

In any other case the problem is quite simple:

I have to open a set of informations packed in the "EDI" format (pure, plain, text).

Almost records of such that format may be of different length.

The task to be preformed is pure conversion of those records (trimming unuseful informations) in another set of data with fixed length.

Till now the task has been done with a very old QuickBasic program, that, today does run anymore on 64Bit O.S.

Just to avoid time-wasting is it possible open each original record in a way similar to QB? (example follows)

NIVA = 1 'counter for V.A.T. values

CMDIN$ = RTRIM$(LTRIM$(LEFT$(COMMAND$, INSTR(COMMAND$, "!") - 1)))
CMDOUT$ = LTRIM$(RTRIM$(MID$(COMMAND$, INSTR(COMMAND$, "!") + 1, LEN(COMMAND$) - 2))) + ".TXT"


IF CMDIN$ = "" THEN
    CLS: PRINT "Input file missing: " + CMDIN$
    SLEEP 4
    SYSTEM
END IF

OPEN CMDIN$ FOR INPUT AS #1
IF LOF(1) = 0 THEN
    CLS: PRINT " Input file missing. END OF  GAMES. ME NE VADO"
    SLEEP 3
    SYSTEM
END IF

OPEN CMDOUT$ FOR OUTPUT AS #2
WHILE NOT EOF(1)
    LINE INPUT #1, RIN$

.......

and so on.

Explanation: every EDI file is "passed" to the program through another program thas has recorded Input filename and output filename separated by "!"

May I implement the same steps with AutoIT?

Thanks for evey answer and suggestion:

by Year1967

 

Link to comment
Share on other sites

Hi. Wellcome to AutoIt Forum. it's easy. and easier if you provide some txt file input and the possible output.

 

Saludos

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...