Re: list to a text representation of that list
Re: list to a text representation of that list
- Subject: Re: list to a text representation of that list
- From: jj <email@hidden>
- Date: Wed, 16 Mar 2005 09:26:41 +0100
> In fact, I really want a text representation of what might be a nested
> list of lists.
>
> {"One","Two","Three", {"Four","Five",{91,"Two",166, 212}, ""},}
>
> and so on. Messing with 'Applescript's text item delimiters' seems to
> be getting me nowhere. Can anyone help? Thanks.
For this list (or other more complex data structures) you may try this
handler:
--> eg
whateverToText({1, "a", {x:2}}) --> "{1, \"a\", {x:2}}"
on whateverToText(x)
try
if class of x is in {string, Unicode text} then
try
count x
return x
on error msg --> handle data string/utxt
return text 1 thru -39 of msg
end try
else
tell application x to beep
end if
on error msg
set msg to text 23 thru -2 of msg
if msg starts with "(" and msg ends with ")" then --> unknown object
return text 2 thru -2 of msg
else
return msg
end if
end try
end whateverToText
jj
--
http://www.macscripter.net/
http://www.osaxen.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden