Re: Reading Lists and Records from Disk Files
Re: Reading Lists and Records from Disk Files
- Subject: Re: Reading Lists and Records from Disk Files
- From: email@hidden
- Date: Sat, 6 Jan 2001 12:39:48 EST
Hi All,
I am trying to save applescript lists and records to and from disk files
without much success. A single list such as {"One","Two",Three"} will come
back as expected, but a list of lists such as {{"One", "Two", "Three"},
{"Four", "Five", "Six"}} or a record such as {thename:"Popeye",
thevice:"Spinach"}
will generate an "Out of Memory Error" when reading it back.
I am aware of the need to coerce the data to the appropriate class when
getting it from disk i.e "as list" or "as record", but only text and single
lists want to play ball. Any suggestions?
This is an example which works for single lists but not a list of lists.
set my_file to open for access file target_file_path
set my_data to (read my_file as list)
close access my_file
If you replace "as list" with "as record" (in the case when it is a record
you are retrieving), it doesn't work. Interestingly if you remove the
coercion, what comes back is the raw data which proves it was a proper
record, but then you can't do much with it.
"reco\\\usrflist\\\TEXT\\\thenameTEXT\\\PopeyeTEXT\\\theviceTEXT\\\Spinw
ich"
Patrick Mounteney