Re: Create a list of lists?
Re: Create a list of lists?
- Subject: Re: Create a list of lists?
- From: SemiColon <email@hidden>
- Date: Mon, 8 Jan 2001 09:42:09 -0800
At 11:36 AM -0500 1/8/01, Michael Kern wrote:
>
I need to create a list of lists (maybe even a list of list of lists!!)
>
>
Something along the lines of:
>
{{{EventName1}{Year11, Year12, Year13}},{{EventName2}{Year21, Year22,
>
Year23}},{{EventName31}{Year31, Year32, Year33}}}
>
>
I can capture the user entered data in variable with no problems. But
>
whenever I try to create a nested list of this type I just get a long
>
single comma delimited list.
>
>
Does anyone know how to do this?
>
Thanks.
It is possible you need to initialize the lists with {}
Select some items in the Finder, and run this script in Script Editor
leaving the items still selected in Finder. While it does not answer your
specific question, it demonstrates the how of nesting lists.
;
tell application "Finder" to set theFiles to the selection
set outerList to {}
repeat with theFile in theFiles
set thePath to theFile as string
set AppleScript's text item delimiters to ":"
set innerList to {}
repeat with i from 1 to the number of text items in thePath
if (text item i of thePath) is not "" then --
if (text item i of thePath) is not the last text item of thePath then
copy text item i of thePath & ":" to end of innerList
else
copy text item i of thePath to end of innerList
end if
end if
end repeat
set AppleScript's text item delimiters to {""}
--set outerList to outerList & {innerList}
set end of outerList to innerList
end repeat
outerList