Re: Handlers in applications
Re: Handlers in applications
- Subject: Re: Handlers in applications
- From: has <email@hidden>
- Date: Sat, 12 Feb 2005 18:44:28 +0000
Irwin Poche wrote:
It appears that applications can't deal with simple condition handlers.
This example issues an Applescript Error "TextEdit got an error: Can't
continue simplicity."
This behaviour is both correct and sensible. Any time you send a
message to something that doesn't understand it you get an error.
e.g. Send a 'shut down' message to TextEdit instead of Finder, and
you'll get an error there.
I think what's confusing you is that you're using one syntax to send
messages to the local script and another to send messages to the
remote application. You're assuming that because they look different
it means they are different. Appearances are highly deceptive,
however. Geneath the surface they're the *exact same thing*, and
therefore they all operate by a single standard set of rules. [1]
To illustrate, the following code is just as legal - and just as
wrong if I actually want the 'print' message to be handled by the
current script and not by the application:
tell application "MyAppleScriptApplet"
doSomething()
print "testing"
end tell
on print xxx
display dialog xxx
end print
The first example will work by using a tell me to before simplicity but
that seems unnecessary and kludgy.
Not at all. The special 'me' variable always contains a reference to
the current script object, and is provided precisely so you can
target a message at that script even when you're in the middle of a
tell block that's targeting some other object.
Although I'd recommend normally using:
my simplicity("testing")
instead of:
tell me to simplicity("testing")
as it's both more precise and less verbose.
HTH
has
[1] AppleScript is full of things that look the same but are actually
different (homonyms) and things that look different but are actually
the same (synonyms) - a constant source of confusion for users.
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden