Re: Now is: Finder tell block
Re: Now is: Finder tell block
- Subject: Re: Now is: Finder tell block
- From: Sander Tekelenburg <email@hidden>
- Date: Sun, 3 Mar 2002 18:31:34 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 11:25 -0500 UTC, on 03-03-2002, David Groover wrote:
>
I have to ask. It's embarrassing to admit it, but I sense an important
>
conversation is afoot. I want to learn this point, but I don't know what
>
is meant by a finder tell block. Can someone please give a quick (short)
>
example of what is a finder tell block, and what is not a finder tell
>
block?
Don't be embarrassed. Questions about the basics are the best questions.
tell application "Finder"
-- do something
end tell
This is what we call a "Finder tell block". Commands to the Finder, written
in a form that has a beginning and an ending, and thus looks like a 'block'.
Contrary to what you are led to believe when you start out with
AppleScripting by recording scripts, "Finder tell blocks" are just one of the
things you will encounter in AppleScript. You may already have discovered
that you can not only script the Finder, but also other applications. When
you script another application, you'll most often do that too in a "tell
block":
tell application "Eudora"
-- do something
end tell
That's a "Eudora tell block".
But not *everything* you do in AppleScript is telling an application to do
something. For instance, you can assign a variable a value without any
application being involved:
set aVariable to "some text"
display dialog aVariable
There are also commands available for which there's no need to talk to an
application. For instance:
set theDate to current date
Which uses the "current date" command from the "Standard Additions" Scripting
Addition.
Because of several reasons, as described by Paul Berkowitz and others, it is
considered good practice to *only* place code in a tell block when that code
is aimed at a specific application. Speed can be one reason, but I think that
the clarity of the code is a more important argument. The more clear your
code, the easier you can keep track of what you're doing.
HTH
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <
http://www.pgp.com>
iQA/AwUBPIJd4esywKfXgqKdEQKWZACgyw/1HGkKmNyYZK0MJ4gBkmA1ojQAoJSI
q93OiKvFAJ4gKyDQpvtL9D+6
=XwmY
-----END PGP SIGNATURE-----
--
Sander Tekelenburg, <
http://www.euronet.nl/~tekelenb/>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.