Compacting stacks and todays' newbie question

Dreamscape Software webmaster at dreamscapesoftware.com
Wed Apr 17 07:37:01 EDT 2002


> 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

>From what it looks like, your just taking the data from the same file and
putting it into a field on each card.  What I would recomend is that you
open the file and read the data only once, then close the data.  Then go
through each card and put it into the field that you want.

Try this...


    put "fred.txt" into fileName
    open file fileName for read
    read from file fileName until eof
    put it into fileData
    close file fileName

    repeat with x=1 to the number of cards
        put fileData into field "field1" of card x of this stack
    end repeat


That's pretty much the same thing you are trying to accomplish, but should
run much faster.


Derek Bump
Dreamscape Software, Inc.
http://www.dreamscapesoftware.com/



More information about the use-livecode mailing list