Re: Read/write as record
Re: Read/write as record
- Subject: Re: Read/write as record
- From: julifos <email@hidden>
- Date: Fri, 14 Feb 2003 09:56:59 +0100
>
For my AS Studio program I'm trying to save data as record. I don't
>
seem to have any trouble with this:
>
>
write theFile to (POSIX file fileLocation) as record
>
>
However, I get an error when doing the following line elsewhere:
>
>
set theFile to read (POSIX file fileLocation) as record
>
>
Specifically, I get a "Parameter error". I CAN get it to function
>
somewhat by using the following, but it seems to be an unnecessary
>
workaround:
>
>
set theFile to read (POSIX file fileLocation) as list
>
--> {{info:"A few words about your list.", author:"Your name here.",
>
language:"es", |words|:{"Word 1", "Word 2", "Etc."}, |title|:"Records"}}
>
set theFile to item 1 of theFile
>
--> {info:"A few words about your list.", author:"Your name here.",
>
language:"es", |words|:{"Word 1", "Word 2", "Etc."}, |title|:"Records"}
>
>
Does anyone have any ideas? I haven't updated to 10.2.4 yet, but I
>
read there were no AppleScript updates.
Here this works:
set therecord to {a:1, b:2}
set x to (path to desktop as text) & "sometext.txt"
set k to (open for access file x with write permission)
write therecord to k
-- write therecord to k as record --> throws the same output
close access k
--> end write
set k to (open for access file x)
set z to (read k as record)
close access k
z --> {a:1, b:2}
JJ
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.