Re: Finder Tell Blocks
Re: Finder Tell Blocks
- Subject: Re: Finder Tell Blocks
- From: Sander Tekelenburg <email@hidden>
- Date: Wed, 6 Mar 2002 03:20:43 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
At 19:18 +0000 UTC, on 05-03-2002, has wrote:
>
Sander Tekelenburg wrote:
[...]
>
Yeah, I'd second that. While you may be answering a question from one,
>
you're preaching to an audience of many.:)
And what's better for one's ego than preaching? ;)
[...]
>
I thought your own example:
>
>
tell app "Finder"
>
set theProcesses to name of every process
>
end tell
>
if theProcesses contains "MACS"
>
display dialog true
>
end if
>
>
would actually have been better written as:
>
>
tell application "Finder" to get name of every process
>
if result contains "MACS" then display dialog true
I see you too have AkuaSweets installed ;)
[...]
>
Actually, I think being able to write code that *other* folk can read and
>
understand with minimal effort is one of the measures of good coding
>
practice. And if that issue doesn't worry you, consider another question:
>
will you still be able to grok your own projects 18 months later when
>
you've long forgotten all details of how they work? Sure it might take a
>
bit more effort now, but you'll be glad you did later.
Quite right. It can be maddening to have to adapt an old script and finding
out that your own words have become incomprehensible to you. And you *will*
be in that situation, because you will be upgrading applications, your OS, or
move to a different machine; things that change the script's conditions and
may require a change to the script. (Which touches upon the issue of writing
portable code ;))
Btw, writing easily understandable code alone is not enough (and may not
always be necessary even). I find that at least equally essential is to add
useful comments to your own code. If at some point you don't understand you
code anymore, your comments will help you out.
I tend to add comments to just about everything that is not completely
obvious to me. I even sometimes need to go through a script and remove
comments, because there are so many that the code itself gets lost... :)
(Hm... Would be cool to be able to toggle comments on/off in an editor. Does
any existing AS editor do that?)
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <
http://www.pgp.com>
iQA/AwUBPIV89usywKfXgqKdEQLuowCcD9x97nb4yXvxxsXHad/OSM+Tc+IAoPbg
9bzs8cwokbQAhwXiLub2IULb
=VzYt
-----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.