Re: Looking for clarification on Applescript event handlers
Re: Looking for clarification on Applescript event handlers
- Subject: Re: Looking for clarification on Applescript event handlers
- From: Christopher Nebel <email@hidden>
- Date: Sun, 10 Aug 2003 21:29:33 -0700
On Sunday, August 10, 2003, at 1:43 PM, Chris Backas wrote:
The NSAppleScript class has an executeAppleEvent method, which takes
an AppleEventDescriptor as an argument. I've seen on the Applescript
side that one makes an event handler something like:
on <some event>(<some argument>)
<do stuff>
end <some event>
My confusion is, does that single AppleEventDescriptor I pass
encompass both <some event> and <some argument> ? If I want to pass a
list to a handler in an applescript, do I need to declare my own kind
of handler someplace with its own ID, or are there preexisting ones
that I'm meant to utilize?
This question would have been more appropriately asked on
applescript-implementors, but never mind that. You should go read
QA1111, "Calling an Applescript and providing parameters from an
application," <
http://developer.apple.com/qa/qa2001/qa1111.html>. It's
written for C, but shouldn't be too hard to translate to Obj-C.
The basic point is that an "event" encapsulates both the handler name
and its parameters. The handler you use can be defined one of three
ways:
1. Define your own handler name and call it with positional parameters,
as in QA1111.
2. Define terminology for your handler and call it with named
parameters (Folder Actions does this).
3. Use an existing standard handler, such as "run" or "open".
As far as how to call them, #1 is illustrated in QA1111. #2 is just
like sending a "normal" Apple event to an application, and #3 is just a
special case of #2. Obviously, using #3 appropriately depends on what
you intend to do in the handler.
--Chris Nebel
Apple Development Tools
_______________________________________________
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.