• 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: Folder name from alias
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Folder name from alias


  • Subject: Re: Folder name from alias
  • From: email@hidden
  • Date: Fri, 8 Dec 2000 19:41:44 -0500

On Thu, 07 Dec 2000 23:48:26 -0600, Rick Plummer <email@hidden>
asked,

> I need script that will extract the folder name of a folder
> dropped on an applet (for use later inthe script).
>
> e.g.:
> on open x
> tell application "Finder"
> yada
> yada
> make new folder at (location) with properties
> {name:<folder name from x>}
>

Its simplest to just ask the Finder. I'll acknowledge that the convoluted
text-parsing approaches might run faster, but since this is a user-interaction
droplet, and were only getting the name from the Finder once, the time delay
won't be noticeable.

Personally, I avoid "info for" on folders, because it can take a lot of time
(more than five seconds) if the folder contains lots of files. That's bad for
the user interface.

I've added testing for incorrect use. If the user drops more than one item, or
if it isn't a folder, the script just exits. I'm worried by "item 1 of
fileList" may or may not do what the user intended. What icon is item 1? The
first icon clicked? What if the user drag-selected?

on open fileList
if count of fileList isn't 1 then return
set originalFolder to item 1 of fileList
tell application "Finder"
if class of item originalFolder isn't folder then return
yada -- invoke the Seinfeld osax. :-)
make new folder at (location) with properties ,
{ name:name of originalFolder }
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden


  • Prev by Date: Re: Folder name from alias
  • Next by Date: Re: continuation character [was Folder name from alias]
  • Previous by thread: Re: Folder name from alias
  • Next by thread: Re: Folder name from alias
  • Index(es):
    • Date
    • Thread