Re: Saving to array list
Re: Saving to array list
- Subject: Re: Saving to array list
- From: "Houston, Brad" <email@hidden>
- Date: Thu, 01 Nov 2012 13:59:44 -0400
- Acceptlanguage: en-US
- Thread-topic: Saving to array list
Title: Re: Saving to array list
Could you not record the array as a sequence of lists, without the closing bracket (i.e., {"a"}, {"b"}, {"c"}), then simple write additions to EOF. If/when you need to read it as an array you add the closing
bracket on the fly.
Brad
On 11/1/12 10:11 AM, "Axel Luttgens" <email@hidden> wrote:
Le 1 nov. 2012 à 15:52, Brian Christmas a écrit :
> G'day scripters
>
> [...]
>
> I've found that if I simply try and add each days new {date,array} to the end of the file, it won't work; I have to read the whole of the saved array, add to it, and then write the whole thing back to the file, otherwise getting the array as a list only reads
the first days entry.
>
> Am I doing the only thing possible (which is slow), or is there a method of simply adding to the file on a daily basis, without reading/adding/saving the whole array. I would much prefer to stay saving and reading as a list, it's faster than my previous method
of saving individual items as a long comma delimited array (but I'd like it faster still).
>
> [...]
Hello Brian,
There may be a (fragile?) way.
Let's suppose you've already written following list
{{"a"}, {"b"}, {"c"}, {"d"}, {"e"}}
to some file F, and that you want to append a sixth element, {"f"}, to that list:
set fRef to open for access F with write permission
write 6 to fRef starting at 5 as data
write {"f"} to fRef starting at (1 + (get eof fRef)) as list
close access fRef
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If
the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have
received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. The McGraw-Hill Companies, Inc. reserves the right, subject to applicable local law, to monitor, review and process the content
of any electronic message or information sent to or from McGraw-Hill e-mail addresses without informing the sender or recipient of the message. By sending electronic message or information to McGraw-Hill e-mail addresses you, as the sender, are consenting
to McGraw-Hill processing any of your personal data therein.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden