MACSCRPT Archives

May 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Deivy Petrescu <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 19 May 2009 17:52:07 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (78 lines)
On 19/05/2009, at 17:28 , Bill Steele wrote:

>> This works for me:
>>
>> set recordList to {}
>> set oneRecord to {foo:1, bar:"hello"}
>> set the end of recordList to oneRecord
>> set twoRecord to {foo:2, bar:"Goodbye"}
>> set the end of recordList to twoRecord
>> recordList
>>
>> HTH,
>>
>> ES
>
> Works for me too.  Thanks.
>
> I wonder where it says that in the Applescript Language Guide.
>
Hi Bill,

It says right there on page 187 (the newest version)
<quote>
record
The concatenation of two records joins the properties of the left-hand  
record to the properties of the right-hand record. If both records  
contain properties with the same name, the value of the property from  
the left-hand record appears in the result. For example, the result of  
the expression

{ name:"Matt", mileage:"8000" } & { name:"Steve", framesize:58 }

is

{ name:"Matt", mileage:"8000", frameSize:58 }
</quote>

Precisely what happens to you.
To make it a list:

set recordList to {}
set oneRecord to {foo:1, bar:"hello"}
set recordList to recordList & {oneRecord}
set twoRecord to {foo:2, bar:"Goodbye"}
set recordList to recordList & {twoRecord}
recordList

>
>>
>>>
>>> set theRecords to {{foo:1, bar:"hello"}, {foo:2, bar:"Goodbye"}}
>>> foo of item 2 of theRecords
>>> --> 2
>>>
>>> But how do you create such a list?
>>>
>>> set recordList to {}
>>> set oneRecord to {foo:1, bar:"hello"}
>>> set recordList to recordList & oneRecord
>>> -->{foo:1, bar:"hello"}
>>> set twoRecord to {foo:2, bar:"Goodbye"}
>>> set recordList to recordList & twoRecord
>>> recordList
>>> -->{foo:1, bar:"hello"}
>>>
>
>
> -- 
>
> Bill Steele
> [log in to unmask]




Deivy Petrescu
[log in to unmask]

ATOM RSS1 RSS2