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

Scripting Filepaths


  • Subject: Scripting Filepaths
  • From: Jon Rosen <email@hidden>
  • Date: Wed, 29 Jul 2009 20:21:41 -0400

These may be basic questions, but I would appreciate your assistance. First, is there a shortcut for referring to a file in a user directory? I can use path to desktop or /Desktop for the Mac's desktop. But, how can I refer to the current user's desktop without using their name? For example:

This works fine: open POSIX file "/Users/admin/Desktop/Sheaffer Flattop.png"

This does not:		open POSIX file "~/Desktop/Sheaffer Flattop.png"

I don't understand why "~" doesn't work with AppleScript filepaths.

The next question is how to refer to the enclosing folder of a file? That syntax doesn't seem to work anymore. For example, if I choose a file with a Choose File command, how can I simply get the folder that contains that file? Do I have to break down the filepath and figure it out for myself or is there a simpler way to do this?

Thanks,

Jon
_______________________________________________
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: Chris Page <email@hidden>
    • Re: Scripting Filepaths
      • From: Tim Mansour <email@hidden>
  • Prev by Date: Re: Excel (2004) Hidden rows show up in tab delimited text file
  • Next by Date: Re: Scripting Filepaths
  • Previous by thread: Re: Excel (2004) Hidden rows show up in tab delimited text file
  • Next by thread: Re: Scripting Filepaths
  • Index(es):
    • Date
    • Thread