MACSCRPT Archives

July 2007

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:
Stan Cleveland <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 27 Jul 2007 14:22:43 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
On 7/27/07 2:12 PM, Gary (Lists) wrote:

> "RJay Hansen" wrote:
> 
>> Can this be done?
> 
> Yes, but you have to follow AppleScript's rules. ;)
> 
> set _list1 to {1, 2, 3}
>   --  {1, 2, 3}
> set _list2 to {"a", "b", "c"}
>   --  {"a", "b", "c"}
> 
> set _list3 to _list1 & _list2 -- make a list out of two lists
>   --  {1, 2, 3, "a", "b", "c"}
> 
> set _list3 to _list1 & {_list2} -- add a list to a list
>   --  {1, 2, 3, {"a", "b", "c"}}
> 
> copy _list2 to end of _list1 -- add a list to a list
>   --  {1, 2, 3, {"a", "b", "c"}}
> 
> copy {"x", "y", "z"} to item 2 of _list1 -- replace an list item with a list
>   --  {1, {"x", "y", "z"}, 3, {"a", "b", "c"}}


And here are two more methods:

    set bothLists to {_list1, _list2} -- make a list out of two lists
      --  {{1, 2, 3}, {"a", "b", "c"}}

    set beginning of _list1 to _list2 -- add a list to the front of a list
      --  {{"a", "b", "c"}, 1, 2, 3}

Stan C.

ATOM RSS1 RSS2