Re: "a reference to"
Re: "a reference to"
- Subject: Re: "a reference to"
- From: Chris Page <email@hidden>
- Date: Mon, 21 Jan 2008 18:06:26 -0800
On Jan 19, 2008, at 7:44 AM, has wrote:
On 19 Jan 2008, at 10:45, Brennan wrote:
As a result I almost never have problems with a missing 'get'. If
it does happen, it can almost always be resolved with adding more
carefully placed parentheses, such as;
set dr to (display dialog (name of (info for (choose file))))
1. Parenthesis do not insert implicit "get"s.
2. Parenthesis are required around commands within an expression.
2b. Some commands look like properties to humans and so can be
confused with part of an object specifier, e.g., "current date", but
they must be enclosed in parenthesis to separate them from a
surrounding object specifier, for example, "year of (current date)".
2c. The AppleScript compiler will automatically insert parenthesis
around commands in some cases. e.g., "command + 1" becomes "(command)
+ 1" and "info for choose file" becomes "info for (choose file)", but
you must explicitly put parenthesis around "(info for ...)" to
separate it from the "name of ..." specifier.
There is nothing in that expression that requires an explicit 'get';
the parentheses are solely to disambiguate AppleScript's ambiguous
syntax so that it can parse without compiler error. (That
parentheses should be necessary simply to prevent the compiler
tripping over itself is a design flaw, although AppleScript isn't
unique in this regard; only worse than unusual.)
It is an error to put a command in an object specifier, so the
parenthesis are required around "info for" and "choose file". Here's
the minimum parenthesis for the example above:
set dr to display dialog name of (info for (choose file))
This is an error
set dr to display dialog name of info for (choose file)
And this
set dr to display dialog name of (info for choose file)
automatically becomes this
set dr to display dialog name of (info for (choose file))
--
Chris Page
The other, other AppleScript Chris
_______________________________________________
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