Re: Creating a folder on the desktop
Re: Creating a folder on the desktop
- Subject: Re: Creating a folder on the desktop
- From: patrick machielse <email@hidden>
- Date: Tue, 06 Sep 2005 22:33:32 +0200
Op 6-sep-2005, om 21:14 heeft Matt Deatherage het volgende geschreven:
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".
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?
I gathered that since "System Events" has a Disk-Folder-File suite,
and since that suite declares a folder class, it would be reasonable
to expect it to create folders. Obviously I was wrong :-) Does the
fact that the 'make' command is not in the Disk-Folder-File suite
indicate that "System Events" can't make folders? (but then again, a
dictionary probably can't declare make twice, both in the standard
suite and somewhere else?) Where would I find the capabilities of
System Event's 'make' command? As an API reference the dictionaries
leave a bit to be desired.
If these are silly questions, please don't hesitate to say so.
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.
OK.
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.
POSIX paths seem to be limited in this respect. However,
tell application "System Events" to get folder "~/.."
just works.
The thing that confuses me: when System Events and Finder both have
suites for manipulating files and folders, how (and _why_), should I
decide which application to use?
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.
Deprecation is just a flag to say "don't use this anymore from now
on". I don't want have it removed immediately and pull the rug from
under anyone's feet. Just yet :-) Deprecation isn't the end of the
world (just the end of the line). About half of Java is deprecated.
It's the other side of progress.
Thanks for your reaction Matt,
patrick
_______________________________________________
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