Alias's in AppleScripts
Alias's in AppleScripts
- Subject: Alias's in AppleScripts
- From: Doug McNutt <email@hidden>
- Date: Thu, 13 May 2004 08:40:52 -0600
At 12:09 -0600 5/12/04, I wrote:
>
<can't resist>
>
AppleScript would do well to dump the alias concept altogether and handle everything as a full path in an OS neXt environment. And get rid of the file specification typedef too.
>
</can't resist>
And I erred in the midst of trying to be funny.
But I was, I think, misunderstood and perhaps the point is worth further discussion.
Aliases since OS 7 are useful things. In the simplest way of looking at one it is nothing more than a 32 bit integer which is the fileID in an HFS file system. The ID is never reused and persists even if a file moves into another directory. Earlier Mac OS versions used fileID's only for directories.
But there is more to an alias in that Finder uses some still-secret techniques to track aliases between partitions and over a network. They are not perfect but, as a couple of people have pointed out, they have advantages over hard and soft links in UNIX. They also can make for problems when, for instance, backing up or cutting a CD in which aliases should be redirected to the copy rather than to an original which is about to disappear.
And that involves understanding the difference between an alias resource and an alias file which contains an alias resource and more. The alias file is somewhat similar to a UNIX symbolic link while a fileID behaves a bit like a hard link but the analogies are far from perfect.
Alias files with their icons and Finder-based GUI are of course useful and I would never suggest that they be dropped from the OS. The question I have is whether or not such things are useful while an AppleScript is running. I can imagine a setup in which an alias file is created in Finder, perhaps in response to a request from a running script, to provide a pointer to a target file that might be moved. But I have trouble with a running script using an alias resource to track a moving target.
When an icon is dropped onto an AppleScript application Finder resolves any aliases and provides only the final target file. But it provides it as an alias! Why? I really don't think it's possible for a user to drop the icon and then move the target while the AppleScript is running.
When one asks for "path to some folder" there is no need to protect against a user changing that location while the script is running. Or is there?
Does anyone use AppleScript's retention of global variables and properties to save an alias between executions? In a stay-open script perhaps? Or a scripted CGI?
Is the confusion of beginning scripters caused by file (fsspec), alias, path, POSIX path, reference to, and others worth the benefits? How many times have people been told, on this list, that they have to insert the word "file" before a string that seems already to be something that can be "opened". They do it but they wonder why if the idiom of the class adjective has not yet been absorbed.
Your thoughts would help me and perhaps others.
At 06:50 -0500 5/13/04, John C. Welch wrote:
>
Nonsense...you'd then have no way to script classic, which is still a
>
requirement. Also, Aliases are *far* better than those sick little symlinks.
>
You mean in 30 years, NO ONE in the unix world can properly deal with the
>
concept that OMGOMG!!!!1111...users sometimes....HORRORS...MOVE a file.
At 01:54 -0700 5/13/04, Walter Ian Kaye wrote:
>
Are you nuts? What if a file moves -- how the hell are you gonna find it?
>
Think for a moment about the power of an alias. Are you really advocating throwing that power into the garbage?
--
--> Life begins at ovulation. Ladies should endeavor to get every young life fertilized. <--
_______________________________________________
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.