Re: AppleScript-Users Digest, Vol 4, Issue 2
Re: AppleScript-Users Digest, Vol 4, Issue 2
- Subject: Re: AppleScript-Users Digest, Vol 4, Issue 2
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 2 Jan 2007 14:41:58 -0500
On 1/2/07, Bryan Lockwood <email@hidden> wrote:
Perhaps I'm just not yet steeped enough in AppleScript, but the following
snippet, taken from a recent digest, leaves me totally nonplussed.
How in the devil am I supposed to parse the line below which reads " tell
Finder window 1 to if exists then". I don't get this at all (although, of
course, I can figure out what it means, it seems to me totally
ungrammatical. Wish I had a yacc grammar for AppleScript, but I know it's
impossible.) This makes split infinitives look beautiful. Anyhow, so much
for readibility.
AppleScript ain't English. It just tries to be. :)
tell Foo to Bar
is just a shortcut to avoid creating a tell block. It's semantically
identical to
tell Foo
Bar
end tell
In either case, the default argument for any message is the recipient
of the tell block, so "exists" by itself in a tell to window 1 asks if
window 1 exists. I think this is equivalent:
tell application "Finder"
if window 1 exists then
...
end if
end tell
I'd be grateful for any further enlightenment.
Bryan
> From: "email@hidden"
> <email@hidden>
> Reply-To: <email@hidden>
> Date: Mon, 1 Jan 2007 16:07:06 -0800 (PST)
> To: <email@hidden>
> Subject: AppleScript-Users Digest, Vol 4, Issue 2
>
> tell application "Finder"
> activate
> tell Finder window 1 to if exists then
> set current view to list view
> set bounds to {5, 45, 1000, 900}
> set v to toolbar visible
> set toolbar visible to not v
> set toolbar visible to v
> end if
> end tell
_______________________________________________
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/mailman//archives/applescript-users
This email sent to email@hidden
--
Mark J. Reed <email@hidden>
_______________________________________________
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/mailman//archives/applescript-users
This email sent to email@hidden