Re: Handlers and Tell Blocks
Re: Handlers and Tell Blocks
- Subject: Re: Handlers and Tell Blocks
- From: has <email@hidden>
- Date: Wed, 28 Aug 2002 13:10:53 +0100
Paul Berkowitz wrote:
>
Handlers require their own internal application tell blocks and are
>
impervious to application tell blocks in which they may be called.
This statement's confusing, but if you mean what I think you mean, then no.
If you send a message from within a tell block, that message will be
received by the object specified by that tell block. Now, whether that
target is an application object, script object or any other sort of object
has no bearing on the message dispatch process. And what that object does
with the message it subsequently receives is entirely up to it.
Tell blocks only really serve two purposes in AppleScript: save you from
having to specify a full target path each time you want to send a message
as you do in, say, JavaScript (particularly convenient when you're sending
multiple messages to the same target); and help the compiler out with
translating all those weird and wonderful English-y phrases we know and
love into something the <<machine>> <<can>> <<understand>>.
In principle, however, a handler call is no different to a osax/application
call is no different to an XML-RPC call [1]. AppleScript's well-intentioned
[2] use of a different syntax for osax/app calls [and XML-RPC calls'
generally weird format] does tend to obfuscate their fundamental sameness,
however. Which is a little ironic, as behind all this dirty black smoke and
silly circus mirrors is a wonderfully simple conceptual model just dying to
get out and make everyone's lives that much easier. :)
>
So does
>
that mean that there is nothing equivalent to the AppleEvent sent to an
>
application within another application's tell block if you call the handler
>
there, slowing things down? I'm wondering about the relative virtues of
>
doing just that, even where a second application's object is involved,
>
rather than creating a whole series of possibly unnecessary variables just
>
so a handler can be called outside a tell block.
Struggling to follow your meaning here. Here's what I think you're asking:
-------
tell application "foo"
tell application "bar"
do something bar_ish
end tell
end tell
In the above example, does the 'do something bar_ish' get sent directly to
application "bar", or does it get routed via application "foo" first? i.e.
Is the 'tell application "bar" statement handled by "foo", or by the local
script?
-------
But I'm not certain. Perhaps you can clarify. [I was, uh, up kinda late
last night, which may explain any denseness on my part.:]
HTH
has
[1] The internal implementation may vary, of course, but that's not
something you ever have to worry about. Forget about AppleEvents and
low-level stuff like that: it's not relevant at the level we're working on.
[2] though somewhat misguided [...but this is a topic for some other time;]
_______________________________________________
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.