Re: Editing Lists of LISTS
Re: Editing Lists of LISTS
- Subject: Re: Editing Lists of LISTS
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 18 Jan 2008 16:33:34 -0500
On Jan 18, 2008 3:33 PM, Justin Laden <email@hidden> wrote:
> I'm trying to loop through a list of lists and I'm having trouble
> accessing the inner lists---I get this error:
>
> Can't make {{"purple"}, {"blue"}, {"black"}} into type integer.
That error is not from the code inside the loop., because your script
never gets that for. The error is on the repeat lines.
> repeat with i from 1 to (twoList)
> repeat with j from 1 to (twoList)
The thing you count up to has to be a number; you're supplying a list,
and that's why the error. You can't count from 1 up to
{{"purple"},{"blue"},{"black"}}. I suspect you want something like
this:
repeat with i from 1 to length of twoList
repeat with j from 1 to length of (list i of twolist)
although you could also just loop through the outer loop directly
instead of counting:
repeat with subList in twoList
repeat with j from 1 to length of subList
set item j of subList to "green"
end repeat
end repeat
Which I think will work, but I'm not at my Mac...
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden