• 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: "a reference to"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "a reference to"


  • Subject: Re: "a reference to"
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 16 Jan 2008 09:55:38 -0800

On Jan 15, 2008, at 2:09 PM, Stan Cleveland wrote:

On 1/15/08 1:41 PM, Luther Fuller wrote:

I just went to my hardcopy AppleScript Language Guide [Addison-
Wesley, 1993], which I seldom look at these days. It defines 'get'
and indicates that it is optional, always. (At least, it was in
1993.)

I just checked the latest and last hardcopy ASLG printed [Apple Developer
Connection, 1999, sold through fatbrain.com, covering AppleScipt v1.3.7].


On page 143, it says "...the Get command is optional because AppleScript
automatically gets the value of expressions and references when they appear
in scripts."


So nine years ago, it was still not required.

No, nine years ago the documentation left out some details. This business of implicit vs. explicit "get" commands has always been like this; it's not a Mac OS X thing. Strictly speaking, the documentation is correct -- AppleScript will evaluate object specifiers when they appear in expressions. The problem is that the expression in this case is bigger than you think it is:


tell app "Finder" to set scrWd to item 3 of (bounds of window of desktop)

Parentheses in an object specifier affect grouping (this can be useful when you've got more than one "whose" clause), but it's still considered one specifier, and therefore one expression, so the expression sent to Finder is "item 3 of bounds of window of desktop". Unfortunately, Finder considers "bounds" to be a primitive value with no elements, so it chokes on the "item 3 of" part. Adding an explicit "get" (or an implicit one, by breaking the expression into two distinct pieces) makes Finder evaluate just "bounds of window of desktop"; the result is a list, which AppleScript can then get "item 3 of".


--Chris Nebel AppleScript Engineering

_______________________________________________
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: "a reference to"
      • From: Brennan <email@hidden>
    • Re: "a reference to"
      • From: Luther Fuller <email@hidden>
References: 
 >Re: "a reference to" (From: Stan Cleveland <email@hidden>)

  • Prev by Date: Re: Database from AppleScript
  • Next by Date: Get only the name of the file, instead of the whole path!
  • Previous by thread: Re: "a reference to"
  • Next by thread: Re: "a reference to"
  • Index(es):
    • Date
    • Thread