Re: resetting record values to ""
Re: resetting record values to ""
- Subject: Re: resetting record values to ""
- From: John W Baxter <email@hidden>
- Date: Tue, 2 Jan 2001 08:33:04 -0800
Michelle Steiner wrote
>
On 1/1/01 8:56 PM, John W Baxter <email@hidden> wrote:
>
>
>Michelle Steiner wrote:
>
>>BTW, it looks like you'll have to change the names of the "state" and
>
>>"month" fields because they are already used by Applescript.
>
>
>
>Perhaps not...
>
>copy {state:"a", month:"b"} to x
>
>x's month
>
>
>
>seems to work.
>
>
You're right, but I don't understand why.
>
The underlying, Apple Event Manager implementation of a "record" uses
4-byte codes as the record keys. AppleScript knows about month and
state--therefore it knows a 4-byte code for each of those words.
Therefore, those words can "directly" be keys in a record.
The other words used as keys in a record are not known, therefore they
don't have four byte codes. AppleScript solved that by extending the AE
record with a "user fields" item (code 'usrf'). This item contains a list
of keys and values:
{"key1", value1, "keytwo", valuetwo ... }
AppleScript puts known keys into items of their own, and the others into
the User Fields list. [So Scripting Additions or programs which accept
arbitrary records have to deal with both kinds of items in the records.]
All this is a little more visible if you have keywords and variables styled
differently in you AppleScript preferences.
--John
--
John Baxter email@hidden Port Ludlow, WA, USA