Re: Scripting Filepaths
Re: Scripting Filepaths
- Subject: Re: Scripting Filepaths
- From: Tim Mansour <email@hidden>
- Date: Thu, 30 Jul 2009 10:48:01 +1000
2009/7/30 Jon Rosen <email@hidden>:
> I can use path to desktop or /Desktop for the Mac's desktop
I think you might have misunderstood what the desktop is, Jon. If you
use "path to desktop" you get the path to the current user's desktop
folder, eg:
alias "Macintosh HD:Jon:Desktop:"
In other words, there is no "Mac's desktop", there's only a user's
desktop. Without having to enter the user's name in a script,
therefore, you can use this:
set file_name to "Sheaffer Flattop.png"
open file ((path to desktop as text) & file_name)
To get the enclosing folder of an item you can either extract it from
the full path using string handling, or you can use the Finder's
"container" property:
set the_file to (choose file)
tell application "Finder" to set the_folder to container of the_file as text
--
Tim Mansour <email@hidden>
"The decadent international but individualistic capitalism in the
hands of which we found ourselves after the war is not a success. It
is not intelligent. It is not beautiful. It is not just. It is not
virtuous. And it doesn't deliver the goods." -- John Maynard Keynes
_______________________________________________
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