• 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: Resolving aliases
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resolving aliases


  • Subject: Re: Resolving aliases
  • From: "Steven D. Majewski" <email@hidden>
  • Date: Thu, 28 Jun 2007 12:15:45 -0400


On Jun 28, 2007, at 12:03 PM, Bill Briggs wrote:

At 8:55 AM -0700 6/28/07, Stockly, Ed wrote:
This does not compile, which is as expected:

alias "Dora:this file does not exist"

This does compile, but I would have expected it to have the same compile error as the above code:

alias (path to startup disk as text) & "this file does not exist"

How come?


That's a very clever design. When compiling an alias, the appleScript compiler tries to resolve an alias, and if the item is not present, it returns an error.

However, in order to resolve the alias, the compiler will no execute any script or command.

This allows us to aliases with variables and other commands that don't exist at compile time, but will exist at runtime.

In your example, "path to" is a command (standard editions) and since the compiler doesn't execute command it can't complete the path so it allows the alias to remain unresolved.

It's the same mechanism that allows the following to compile:

set myFile to alias choose file

or

set myFile to chooseFile
alias myFile

And this fails:

class of alias ((path to startup disk as text) & "this file does not exist")



Compiles for me without error!  ( 10.4.10 )



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Resolving aliases
      • From: Bill Briggs <email@hidden>
References: 
 >RE: Resolving aliases (From: "Stockly, Ed" <email@hidden>)
 >RE: Resolving aliases (From: Bill Briggs <email@hidden>)

  • Prev by Date: Re: Resolving aliases
  • Next by Date: Re: Resolving aliases
  • Previous by thread: RE: Resolving aliases
  • Next by thread: Re: Resolving aliases
  • Index(es):
    • Date
    • Thread