• 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: File name list help?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: New to applescript and soap
  • Next by Date: Desktop Picture questions for OS X
  • Previous by thread: Re: File name list help?
  • Next by thread: Re: File name list help?
  • Index(es):
    • Date
    • Thread