Re: Aliases in AppleScripts
Re: Aliases in AppleScripts
- Subject: Re: Aliases in AppleScripts
- From: Christopher Nebel <email@hidden>
- Date: Fri, 14 May 2004 14:25:15 -0700
On May 13, 2004, at 8:53 AM, Mr Tea wrote:
On 13 May 2004, at 3740 pm, Doug McNutt wrote:
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.
Change the script droplet to get the Finder's selection, in place of
the item reference returned by the drop. This will always return a
reference to the dropped item, regardless of whether it is an alias
file or an original file/folder (unless you very quickly change the
selection after dropping - eg, by accidentally clicking on the droplet
with a cack-handed twitch of the finger, just as you are dropping
something onto it).
I get the impression that the two of you are talking about different
problems. Mr. McNutt isn't particularly concerned with the fact that
the alias file gets resolved (I think), it's more the fact that you
still wind up with an "alias" object. That's merely conceptual
confusion -- an "alias" object in AppleScript is just an object that
refers to a file, but one that won't mind if the file moves around.
Mr. Tea seems to be addressing the "I want the alias file, not the
thing it points to" problem. His solution works to some extent, but
assumes that you're always supplying the file using the Finder, which
is probably but not necessarily true -- you could use open(1) in
Terminal, or set the applet as a helper for some other application.
If you really want the alias file (and not the thing that it points
to), then the correct thing to do is to modify the accepted-file-types
resource (either the BNDL resource or the CFBundleDocumentTypes,
depending on whether it's a single-file or bundled applet) to say you
accept files of type 'alis'.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.