Read from file, then display results

Marian Petrides mpetrides at earthlink.net
Thu Jul 8 00:57:31 EDT 2004


Thanks, Mark. Your first example, in particular, is a big help!

Your second example, however, has me a bit confused.

You wrote:
 >>> on mouseUp
>   global gFilePath
>   answer file "select a file"
>   if it contains ".txt" then
>     put URL ("file:" & it) into AddListContents
>     put it into gFilePath
>   else
>     answer " Not a text file"
>     exit mouseUp
>   end if
> end mouseUp
>
> -- work from the variable AddListContents
> -- after all work is done to your var then save it using this:
>
> on mouseUp
>   global gFilePath
>   put compress(AddListContents) into URL ("binfile:" & gFilePath)
>   -- now your file is compressed
>   -- to open and decompress it use:
>   -- put decompress(URL ("binfile:" & it)) into AddListContents
>   -- for none compression save:
>   -- put AddListContents into URL ("file:" & gFilePath)
> end mousUp
>
> hope this helped some,

I was trying to figure out how many items are present in a given file 
in order to help me set the number of iterations needed to get the data 
out of that file and into a series of array variables.

Your second example appears, instead, to be an example of how to WRITE 
to a file. Or am I simply befuddled at this late hour (nearly 1 AM, my 
time)??

M



More information about the use-livecode mailing list