Compacting stacks and todays' newbie question

Klaus Major k_major at osnabrueck.netsurf.de
Wed Apr 17 12:22:00 EDT 2002


Hi Miock,

> in HC when you delete cards etc, you had to compact a stack, I take it 
> this
> is not the case with Rev?
> secondly, I have read the bits in the TD about
> open file "fred.txt" for read
>
> which is used in conjuction with
> read  from file "fred.txt" until EOF
>
> and I know IT is filled with the records, is that all at once? or do I 
> put
> the read in a loop

No loop, all at once.

> the problem I am trying to solve is to read the file (I have one card 
> per
> record) and I propose to  put each record into a field (call it field1) 
> of
> each card

Do you know how the records in the textfile are separated ?
With a CR or something ?
That would help.

> so is this correct (well I know it isn'tbut am I close?)

Yo, quite close ;-)

> put "fred.txt" into filename
> open file filename for read
> put 1 into i
> repeat
>     read from file filename until EOF
>     put it into field field1 of card i
> end repeat
> close file filename
>
> thanks
>
> miock

I think it would be effective to read the file into a var first.
Then parse the var and put it into some fields.

But we need more info about the records are stored.

Example: Each record is a "line" in your file -> CR separated.

Then you could script:

put url"file:fred.txt" into the_recs
put the num of cds into noc
repeat with i = 1 to noc
   put line i of the_recs into fld 1 of cd i
end repeat

you get the picture...


Regards


Klaus Major
k_major at osnabrueck.netsurf.de




More information about the use-livecode mailing list