• 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
Addressing files without all the object palaver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Addressing files without all the object palaver


  • Subject: Addressing files without all the object palaver
  • From: Timothy Bates <email@hidden>
  • Date: Fri, 18 Jan 2002 13:24:40 +1100

On 18/1/02 4:49 AM, "A A" <email@hidden> wrote:
> Is there a way to define a path in AS without sounding
> like the Old Testament?
>
> Something like: "drive/folder/file"
>
> instead of:
> 'And lo-and-behold, "Drive" begat "Folder-A" who
> begat "Folder-B" who begat "File" and then the
> Mennonites ... :-D

Yes. It is only the finder (because files are objects to it) that wants to
treat file paths as object containment hierarchies

So: no one but the finder understands the "a of b of c of d" form, and in
the finder you can always convert to and from this by using names like alias
and string.

"file A of disk b" as string --> "b:A"
"file A of disk b" as alias --> alias "b:A"

You can ask the finder for the contents of a folder as "alias list"

tell application "Finder"
every file of (folder choose folder) as alias list
-->{alias "Cortex:Users:tim:file1",alias "Cortex:Users:tim:file1"}
end tell

(beware that this foolish coercion returns an error if there is only 1 item
as it refuses to make a 1-item list. Don't ask why.)

tim


References: 
 >(no subject) (From: A A <email@hidden>)

  • Prev by Date: Re: Smile 1.8.7 update problem
  • Next by Date: Re: HD name change for X
  • Previous by thread: (no subject)
  • Next by thread: compactness of expression question
  • Index(es):
    • Date
    • Thread