• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Saving to array list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving to array list


  • Subject: Re: Saving to array list
  • From: Axel Luttgens <email@hidden>
  • Date: Thu, 01 Nov 2012 18:11:40 +0100

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


  • Follow-Ups:
    • Re: Saving to array list
      • From: Axel Luttgens <email@hidden>
    • Re: Saving to array list
      • From: Axel Luttgens <email@hidden>
    • Re: Saving to array list
      • From: "Houston, Brad" <email@hidden>
  • Prev by Date: Re: Another question about the date class
  • Next by Date: Re: Saving to array list
  • Previous by thread: Re: Another question about the date class
  • Next by thread: Re: Saving to array list
  • Index(es):
    • Date
    • Thread