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

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


  • Subject: Re: How to get the names of items in a Finder selection.
  • From: John W Baxter <email@hidden>
  • Date: Sun, 24 Dec 2000 16:06:12 -0800

At 12:49 -0800 12/24/00, Michelle Steiner wrote:
>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.

See below: you can let "Finder" extract the names for you, in the one
command to Finder.

>
>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"
>

Another possibility is
tell application "Finder"
name of items of selection
end tell

which a moment ago correctly returned

{"Drop_PDF", "DropStuff", "Drop*PS", "StuffIt Expander", "Folder Script"}


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

Which my suggestion does not. I can see uses for both methods.

--John
--
John Baxter email@hidden Port Ludlow, WA, USA


References: 
 >How to get the names of items in a Finder selection. (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: Tell Launcher to quit
  • Next by Date: Re: How to get the names of items in a Finder selection.
  • Previous by thread: How to get the names of items in a Finder selection.
  • Next by thread: Re: How to get the names of items in a Finder selection.
  • Index(es):
    • Date
    • Thread