Re: "Choose file" bug?
Re: "Choose file" bug?
- Subject: Re: "Choose file" bug?
- From: Christopher Nebel <email@hidden>
- Date: Tue, 27 Sep 2005 18:22:44 -0700
On Sep 27, 2005, at 10:51 AM, Michelle Steiner wrote:
On Sep 27, 2005, at 8:56 AM, Christopher Nebel wrote:
choose file default location (path to applications folder) with
showing package contents
Yes, it works, but the parentheses shouldn't be necessary.
While the AppleScript compiler can, in many cases, figure out that
a parameter name must be associated with one command or another,
"with" is a special case: it can legitimately show up on any
command, and the compiler isn't smart enough to figure out that
this "with" really belongs with "choose file" and not "path to".
(It's also not smart enough to backtrack when it fails.)
Why doesn't it just use it with the text that follows it?
Because then you wouldn't get a compile error *and* it wouldn't work
right. The reason this is a problem at all is that because of the
precedence rules involved, AppleScript is trying to parse the
statement like this
choose file default location (path to applications folder with
showing package contents)
...where what you're trying for is this:
choose file default location (path to applications folder) with
showing package contents
The reason this gets flagged the way it does is subtle. You know, of
course, about how "tell" blocks bring terms into scope. Well,
there's an additional scoping: when the AppleScript compiler sees a
command, it restricts the known terminology to the terms defined by
that command's parameters (plus the standard AppleScript terms, such
as "given" and "with"). Because it's still trying for "path to", it
doesn't recognize "showing package contents" as a valid term.
--Chris Nebel
AppleScript and Automator Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden