• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: list to a text representation of that list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: list to a text representation of that list
      • From: yvan-koenig <email@hidden>
References: 
 >list to a text representation of that list (From: "J.C.Burns" <email@hidden>)

  • Prev by Date: Re: Address Book Scripts
  • Next by Date: Re: list to a text representation of that list
  • Previous by thread: Re: list to a text representation of that list
  • Next by thread: Re: list to a text representation of that list
  • Index(es):
    • Date
    • Thread