Re: Record Access osax
Re: Record Access osax
- Subject: Re: Record Access osax
- From: Andrew Oliver <email@hidden>
- Date: Mon, 10 May 2004 16:01:24 -0700
Oops, you're right, I missed the 'record' part.
How about:
set list1 to {"a", "b", "c"}
set list2 to {1, 2, 3}
set cmd to "{"
repeat with i from 1 to (count list1)
set cmd to cmd & item i of list1 & ":" & item i of list2
if i < (count list1) then set cmd to cmd & ", "
end repeat
set cmd to cmd & "}"
run script cmd
--> {a:1, b:2, c:3}
Additional error checking is probably needed for production purposes to make
sure the number of items in each list matches, and potentially to deal with
other object types (what if list1 contains an integer, or list2 is a list of
lists?
Andrew
:)
On 5/10/04 1:55 PM, "Michelle Steiner" <email@hidden> wrote:
>
On May 10, 2004, at 11:34 AM, Andrew Oliver wrote:
>
>
> OK, I'm confused. What does Ed Lai's tools do that the standard
>
> AppleScript
>
> doesn't?
>
>
>
> set list1 to {"a", "b", "c"}
>
> set list2 to {1, 2, 3}
>
>
>
> set combinedList to list1 & list2 -->{"a", "b", "c", 1, 2, 3}
>
>
>
> Or maybe you'd prefer:
>
>
>
> set combinedList to {list1} & {list2} --> {{"a", "b", "c"}, {1, 2, 3}}
>
>
From what Fraser wrote, the tools will combine two lists into one
>
*record*, not into one list as you showed.
>
>
My guess is that if you have the two lists you posited, Ed Lai's tools
>
would result in {a:1, b:2, c:3}
>
>
-- Michelle
>
>
> On 5/10/04 10:36 AM, "Fraser" <email@hidden> wrote:
>
>
>
>> Has anyone compiled Ed Lai's Record Access osax for OS X? I could
>
>> really
>
>> use an osax to combine two lists into one record.
_______________________________________________
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.