Re: Creating a folder on the desktop
Re: Creating a folder on the desktop
- Subject: Re: Creating a folder on the desktop
- From: Matt Deatherage <email@hidden>
- Date: Tue, 6 Sep 2005 14:14:06 -0500
On 9/6/05 at 1:36 PM, patrick machielse <email@hidden> wrote:
> More importantly, the System Events library explicitly mentions the
> 'make' command, with semantics almost identical to those of the
> Finders 'make' command, which to me is like a promise that it should
> work. Also, I _can_ move folders using "System Events".
a) "Dictionary," not "library," unless I'm missing something.
b) "make" is a standard AppleScript object command, implemented by thousands of applications. Is it your contention that System Events should be able to make *any* object in any application? Or just every object in its own dictionary? Should it also be able to create disks?
This is not intended to sound flip, just to emphasize that very few applications can create every object they recognize. Creating folders probably wasn't a priority with the Finder around.
> Why is it that Finder doesn't understand "~/Desktop"? Finder should
> 'get with the program', the forward slash has been with us for more
> than 4 years now. If anything, the use of ':' should be deprecated,
> that should have been in the coffin with OS 9 :-)
Oh, sure, until you try to get 'file "~/Desktop/Agenda for 9/6/2005", and then there's nothing left but the weeping.
If you want to use a POSIX path, try using a POSIX path.
> posix file "~/Desktop/"
compiles just fine, though it gets changed to
> file ":~:Desktop:"
The problem is that AppleScript (Finder, System Events, etc.) does not recognize "~" as the path to the user folder. It can't use the reference (file "~:Desktop:"). I don't think it recognizes "." or ".." in POSIX paths, either. The solution is to use AppleScript's native reference to these folders, like "path to user folder", as already mentioned.
> Just last night I watched the 2003 WWDC AS presentation from Sal
> Soghoian, in which he talked about the 5 ways to reference files in
> AS, and today, in 2005, I'm still running into walls.
You'll find more sense when you think about backwards compatibility. Scripts developed ten years ago would break if "/" was automagically changed to ":" in "file" or "alias" references, especially since HFS and HFS Plus allow "/" in filenames. AppleScript added an entirely new class for POSIX paths, and with the exception of not expanding shell metacharacters like "~", it works just fine.
Calling for ":" to be deprecated is to call for tens of thousands of mission-critical scripts to need revision because some people are more comforable typing UNIX pathnames. IMHO, that's not sufficient reason for such a disruptive change.
History always complicates things.
--
Matt Deatherage <email@hidden>
GCSF, Incorporated <http://www.macjournals.com>
"At 20, we worry about what others think of us. At 40 we don't care
what others think of us. At 60 we discover they haven't been thinking
of us at all." -- Bob Hope
Now Playing "Copperline" by James Taylor, from "Greatest Hits Volume 2"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden