Re: File name list help?
Re: File name list help?
- Subject: Re: File name list help?
- From: Harvey Dutoff <email@hidden>
- Date: Sun, 7 Oct 2001 04:09:39 -0700
On Sat, 06 Oct 2001, "T.J. Mahaffey" <email@hidden> wrote:
>
I'm working on a script which will make it easier to manipulate names of
>
files for pasting into emails or word processors.
>
>
What I have so far works like a champ, but I'd like to be able to insert a
>
common character after each item in the list. In it's current state, the
>
paste-able clipboard comes out like this: item1item2item3
>
>
I'd LIKE it to come out like this:
>
>
item1, item2, item3
>
>
OR with a return after each item
Try this:
set rList to ""
-- initialize the result
try
tell application "Finder" to set iList to name of items of selection
-- get a list of the names of the selected items from the Finder
repeat with c from 1 to length of iList
-- walk though the items the list...
set rList to rList & (item c of iList as text) & return
-- ...adding each item and a return to the result
end repeat
on error number -1728
-- trap the "there's nothing selected" error
end try
set the clipboard to rList
-- that's from Jon's Commands OSAX
HTH
Harv