Re: Aliases in AppleScripts
Re: Aliases in AppleScripts
- Subject: Re: Aliases in AppleScripts
- From: Walter Ian Kaye <email@hidden>
- Date: Sat, 15 May 2004 12:50:48 -0700
At 10:01p -0700 05/14/2004, Christopher Nebel didst inscribe upon an
electronic papyrus:
On May 14, 2004, at 2:25 PM, Cliff Pruitt wrote:
Why couldn't the names of the old file types be synonymous with the
new file type for several versions allowing legacy scripts to
continue unbroken?
Nice idea, but it wouldn't work, at least not completely. You could
make "alias" and "file specification" synonyms for "file", which
would solve the existence problem, but there are still the semantic
differences to consider. For example, you currently can't make an
"alias" object to a file that doesn't exist -- some scripts exploit
this to test for the existence of files without using the Finder.
If the One True File class *does* allow that, which it more or less
has to, then those scripts break.
Would the trick of using " (obsolete)" (as in 'file type (obsolete)') work?
[I]t seems like AppleScript can't decide what type of... Path(?)
it wants to use as far as display. It seems like if I reference
something manually I need to use mac styled delimiters (:) but if I
drop something on, say a AS Studio drop zone, it returns a POSIX
path. Maybe my example is backward or maybe its just altogether
off, but I'm a little confused about what type of path syntax AS
expects to be working with. Is there a hard & fast distinction
between using POSIX & Mac Paths & switching between them?
This is part of the problem, but a relatively small one, I think.
HFS- and POSIX-style paths are simply different ways of expressing
the same thing. Neither is really superior, and if you have one,
you can generate the other. Which path style to use depends on who
you're talking to -- traditional AppleScript parts typically use
HFS-style; Studio tends to use POSIX-style because of its Cocoa
base. Remember that AppleScript the language doesn't impose any
path rules on applications -- an application could use MS-DOS paths
if it really felt like it.
Like FoxPro did. :-) Back in the days when it was cross platform, it
used DOS-style pathnames as the native form, and translated between
that and Mac or Unix depending on which platform it was running on.
However, consistency is valuable, which is why the Scripting
Interface Guidelines exist, and in particular is why they talk about
treating files as objects, not paths. (One of the reasons I'm fond
of Finder-style file specifiers is that they side-step the path
style issue. Of course, they have the problems of being verbose and
backwards.)
I've toyed with the idea in my head of path components as a list, like
{"Volume Name", "Folder 1", "Folder 2", "foo"}.
I've also thought about a new kind of file URL, one which is "smart"
and could handle FindFolder codes (and file system domains) to locate
files. Something like "locfile://userpref/com.apple.textedit.plist".
-boo
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.