Re: generic event handlers
Re: generic event handlers
- Subject: Re: generic event handlers
- From: Chris Nebel <email@hidden>
- Date: Wed, 14 Feb 2001 13:46:51 -0800
- Organization: Apple Computer, Inc.
David Oberst wrote:
>
I have an Applescript applet which has "on <event XXXXyyyy>" handlers for a
>
few custom Apple Events, which I use as a simulation tester for the actual
>
program that handles them. I can't seem to find any way to create a
>
"generic" event handler, so that I could do something like "on <event
>
XXXX****>" to handle all events in the "XXXX" class.
>
>
Without it I have to keep Applescript up to date with changes in the real
>
program, so that it handles all the same events.
>
>
Even syntax for a handler for "otherwise unhandled events" would be useful.
>
Was I dreaming that I thought that Applescript could do this?
Apple Events can do this sort of thing, but AppleScript can't. While it's
possible to define a handler for a raw event code, AppleScript always does an
exact match of the code you supply with no wildcard interpretation. If you
were willing to write your own applet shell, you could arrange for otherwise
unhandled events to be sent to a special handler in the script, but that might
be more work than you want to deal with.
--Chris Nebel
AppleScript Engineering