• 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: Scripting Filepaths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Filepaths


  • Subject: Re: Scripting Filepaths
  • From: Tim Mansour <email@hidden>
  • Date: Thu, 30 Jul 2009 11:37:18 +1000

2009/7/30 Jon Rosen <email@hidden>:
> I actually need to find the path to the user's Library.

OK, you need to check the syntax for the "path to" command in the
Standard Additions. One of the optional parameters specifies which
"domain" you're looking at:

path to library folder from user domain
--> alias "Macintosh HD:Users:jon:Library:"

path to library folder from system domain
--> alias "Macintosh HD:System:Library:"

path to library folder from local domain
--> alias "Macintosh HD:Library:"

What you've discovered is that the local domain is the default for
"path to library folder" when no domain is specified.

> AppleScript seems very unforgiving when it comes to filepaths.

While we're there you might also note in its dictionary that "path to"
can take a parameter "as string" or "as alias":

path to library folder from user domain as string

This is subtly different to:

(path to library folder from user domain) as text

... in which "path to ..." returns an alias which is then coerced to
text by AppleScript. Hence, the former version is more efficient.

>  AppleScript seems very unforgiving when it comes to filepaths.

Depends on your perspective. We've all been through the confusion;
thankfully I had an excellent teacher (thanks Shane!). But some would
say much of the confusion comes from parts of AS being *too* forgiving
and automatically coercing form one thing to another.

The AppleScript Language Guide on developer.apple.com is a good place
to start, make sure you read the section on files & aliases.

--
Tim Mansour <email@hidden>

"The least initial deviation from the truth is multiplied later a
thousandfold." -- Aristotle
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Scripting Filepaths
      • From: James Bensley <email@hidden>
References: 
 >Scripting Filepaths (From: Jon Rosen <email@hidden>)
 >Re: Scripting Filepaths (From: Tim Mansour <email@hidden>)
 >Re: Scripting Filepaths (From: Jon Rosen <email@hidden>)

  • Prev by Date: Re: Excel (2004) Hidden rows show up in tab delimited text file
  • Next by Date: Re: In a handler passed as a parameter to a handler in another script, how do I refer to top-level variables from the original script?
  • Previous by thread: Re: Scripting Filepaths
  • Next by thread: Re: Scripting Filepaths
  • Index(es):
    • Date
    • Thread