importing text

Klaus Major klaus at major-k.de
Wed Jun 4 07:27:00 EDT 2003


Hi Nicholas,

> Is there a simple way to script text importing so that  each cr 
> delimited line goes into a field on the next card?
> I have a field where I will store the name of a file that will then be 
> imported into another field.
> I can see how to import manuaally one card ata a time but can't figure 
> the scripting for it?

Do you mean one separate card for each line in the text-file?

In this case you can script this:
(Supposed you want to create all missing cards for all lines
in the file... You should create a group with a field in it, which has 
its
"sharedtext" prop set to false and the "backgroundbehaviour" of that 
group
set to true.)

on mouseup
    put url("file:your_text_file_here.txt") into thetext
     repeat for each line l in thetext
       create cd
       put l into fld “just one line"
     end repeat
     unlock screen
end mouseup

Tested and works :-)

Took 0.5 secs for 1000 lines, not too bad...

> thanks

You're welcome...

> Nick
> -- 
> Project Manager
> nickt at paradisec.org.au
> Ph 61 (0)3 8344 5185

Regards

Klaus Major
klaus at major-k.de




More information about the use-livecode mailing list