Re: Simple question
Re: Simple question
- Subject: Re: Simple question
- From: "Marc K. Myers" <email@hidden>
- Date: Wed, 14 Feb 2001 23:59:58 -0500
- Organization: [very little]
>
Date: Fri, 09 Feb 2001 16:54:31 -0800
>
From: Gary Hobish <email@hidden>
>
Subject: Simple question
>
To: email@hidden
>
>
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?
"name of every item of the folder newImagesFolder" is a list value; a
list of names. When you coerce it to text, it does so using
AppleScript's default text item delimiters, a null string. Therefore
you get all the names in the list strung together with nothing between
them. Here's a better approach:
set nameList to name of every item of the folder newImagesFolder
set {od, AppleScript's text item delimiters} to {AppleScript's text item
delimiters, {", "}}
set nameText to name of every item of the folder newImagesFolder as text
set AppleScript's text item delimiters to od
This time the TID have been changed to a comma and a space, so your
names will appear as a string with the names separated by....a comma and
a space!
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[2/14/01 11:59:34 PM]