Re: Finder Tell Blocks
Re: Finder Tell Blocks
- Subject: Re: Finder Tell Blocks
- From: Andy Wylie <email@hidden>
- Date: Tue, 05 Mar 2002 21:39:33 +1300
iWrote
>
> you can grab something from an app and tell it nuthin...
>
>
>
> display dialog ("MACS" is in (application "Finder"'s every process's name))
>
> as string
>
on 5/3/02 3:01 AM, Sander Tekelenburg at email@hidden wrote:
>
Hm, does that actually work for you? It doesn't for me: "Finder got an error:
>
Can't get name of every process." (This is under Mac OS 9.2.1)
>
yes it works under 8.6, (my bad} I knew I was pushing it and should post
vers. Can somebody possibly verify the above 'no get' is an 8.6 AS 1.3.7
trans version odditie?
or this one...
----------
tell application "Finder" to display dialog {"oneItemList"}
----------
>
This notation does work for me:
>
display dialog ((name of every process of application "Finder") as string)
>
contains "MACS"
>
this coercion wot werkes suggests a recordy, referency fake list and a 'get'
is required...
(get application "Finder"'s every process's name)
>
>
Anyway, while it is certainly true that in such a case you don't tell the
>
application to *do* something, and you also don't use the "tell" terminology,
>
you are still talking to an application.
>
So calling this "to tell it nothing" would be a statement that I'd expect to
>
be confusing to new users.
I think tell is the visible semantic of AS and it's the same 'get' under the
hood regardless of how you wrote it, in can be thought of as taking an
object which happens to belong to Finder without saying please or telling
it, hence grab.
>
Another thing is that while this sort of notation is certainly fine, and has
>
its advantages, for less-experienced scripters it is hard to
>
read/write/debug.
>
agreed it can be difficult to learn the form but with experimentation and
working examples or just clues is how I've learned... and some people
actually enjoy debugging :)
>
The following notation does not suffer from that:
>
tell app "Finder"
>
set theProcesses to name of every process
>
end tell
>
if theProcesses contains "MACS"
>
display dialog true
>
end if
>
>
>
AS was designed to be like natural english to be more easily comprehensible
>
to people without any programming experience. In that same vain, speaking in
>
short, simple sentences will be far more comprehensible to new users than
>
writing long, beautiful but complicated sentences. There's nothing wrong with
>
beautiful, complicated language (quite the contrary - this world lacks it too
>
much), but we shouldn't throw it too easily at new users.
>
I don't think Marc was a new user, he wasn't aware of something and now he
is. I only have my own learning experience to draw on and for me this would
be most helpful as I've learned far more from a piece of code to play with
than many attempts to explain it. I'm a "less-experienced scripter" and
newer computer user than many posting on this list it so I think you might
be trying too hard for the newbie lurkers, if they don't understand and
really want to know they'll 'get it' sooner or later :)
_____________________________ Andy
_______________________________________________
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.