Re: Is is possible to use records in a dynamic way?
Re: Is is possible to use records in a dynamic way?
- Subject: Re: Is is possible to use records in a dynamic way?
- From: Helmut Fuchs <email@hidden>
- Date: Wed, 20 Aug 2003 13:20:28 +0200
At 10:18 Uhr +0200 20.08.2003, Christian Mittendorf wrote:
is it possible to use record labels dynamically?
In Obj-C I can use a NSMutableDictionary with the method
setObject:forKey:
to add keys (labels in AS) dynamically.
Depends on how dynamic you want to get. You can concatenate records
using the '&' operator.
{a: 1, b: "old"} & {b: "new", c: 3}
=> result={a: 1, b: "old", c:3}
Or you can use the run script command from the Standard Additions for
this purpose:
set aSymbolName to "that's a funny symbol"
set aRecord to {anEntry: anything}
set aRecord to aRecord & (run script "{|" & aSymbolName & "|: anything}")
Lots of other tricks relating to records have been discussed in this
list over time. So the archives of this list could be interesting to
search as well.
To delete entries, or to iterate over the labels you need to use
OSAXen (or use tricks bordering on the illegal - see archives).
HTH,
Helmut
_______________________________________________
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.