• 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: Simple question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple question


  • Subject: Re: Simple question
  • From: Phi Sanders <email@hidden>
  • Date: Wed, 14 Feb 2001 21:55:27 -0500

You're specifically telling applescript to give it to you "as text",
thereby coercing the list data structure into a single string.

Unfortunately, I don't know of a nice command to get a comma or
tab delimited text "list" out of an AppleScript {list}...
but I'll take a stab at a custom handler for you :

set testList to {"alpha", "beta", "gamma", "delta"}
set testResult to delimitList(testList)
--> alpha,beta,gamma,delta

on delimitList(aList)
--aList is a {list} data structure
set rData to ""
-- begin with an empty string
set aDelimiter to ","
set j to 1

repeat while j < length of aList
--loop thru all list items
set temp to (item j of aList as string) & aDelimiter
set rData to rData & temp
--concatenates the data
set j to j + 1
-- increments the loop
end repeat

set temp to (item (length of aList) of aList) as string
set rData to rData & temp

return rData
end delimitList


Better scripters than I can weigh in on how to improve this,
but it works and though it may not be elegant, I think it's solid.


~Phi
--
Phi Sanders

"And now, back to your regularly scheduled reality."


On 2/9/01, Gary Hobish {email@hidden} said the following :

>Yet I can't find the answer-
>
>I need to make a list of all files in a chosen folder. The command:
>
>set webFiles to name of every item of the folder newImagesFolder as text
>
>(where webFiles is the list and newImagesFolder is the folder)
>
>yields a list of all the items in the folder, but as a single line with no
>delimiter of any kind.
>
>I know I'm missing something simple (other than my copy of the Goodman book
>which is AWOL). What is it?
>
>Thanks-
>
>Gary Hobish
>Armin Hammer Productions
>San Francisco
>_______________________________________________
>applescript-users mailing list
>email@hidden
>http://www.lists.apple.com/mailman/listinfo/applescript-users


References: 
 >Simple question (From: Gary Hobish <email@hidden>)

  • Prev by Date: Re: Mount volume, slash problem
  • Next by Date: Re: A little off topic
  • Previous by thread: Simple question
  • Next by thread: Re: Simple question
  • Index(es):
    • Date
    • Thread