• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Aliases in AppleScripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: Madness & frustration... What is a file? What is a Path? (From: "John C. Welch" <email@hidden>)
 >Alias's in AppleScripts (From: Doug McNutt <email@hidden>)
 >Re: Alias's in AppleScripts (From: Mr Tea <email@hidden>)

  • Prev by Date: Re: Scripts lose their extensions in OSX 10.3.3
  • Next by Date: Re: Aliases in AppleScripts
  • Previous by thread: Re: Alias's in AppleScripts
  • Next by thread: Re: Aliases in AppleScripts
  • Index(es):
    • Date
    • Thread