• 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
How to get the names of items in a Finder selection.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to get the names of items in a Finder selection.


  • Subject: How to get the names of items in a Finder selection.
  • From: Michelle Steiner <email@hidden>
  • Date: Sun, 24 Dec 2000 12:49:33 -0800

If you use "the selection" you will get a list containing the full path
name of each item in the selection. Then you have to extract the item
names from the list.

tell application "Finder"
the selection as alias list
end tell

--> {alias "Dora:Graphics:", alias "Dora:Games :", alias
"Dora:Documents:", alias "Dora:Installer Logs:"}


Here's a simple way to get a list of only the item names.

tell application "Finder"
activate
copy
set x to the clipboard
end tell

--> "Documents
Games
Graphics
Installer Logs"

As an added bonus, it alphabetizes the list for you.

--Michelle

----------------------------------------------------------------------
| Michelle Steiner | Hard as it may be to believe, my |
| email@hidden | life has been based on a true story. |
----------------------------------------------------------------------


  • Follow-Ups:
    • Re: How to get the names of items in a Finder selection.
      • From: John W Baxter <email@hidden>
  • Prev by Date: Re: Set Clipboard?
  • Next by Date: Re: Tell Launcher to quit
  • Previous by thread: Re: applescript-users digest, Vol 2 #161 - 13 msgs
  • Next by thread: Re: How to get the names of items in a Finder selection.
  • Index(es):
    • Date
    • Thread