Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: OSAExecuteEvent help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OSAExecuteEvent help



On Tuesday, May 22, 2001, at 10:12 PM, applescript-implementors-
email@hidden wrote:

> I've been trying to implement use of OSAExecuteEvent in my application.
> There was a previous posting Chris Espinosa which has some source code
> which I've based my code upon. I'm just calling a subroutine, not an
> event defined in the 'aete' resource. The problem I am having is I
> always get errAEEventNotHandled. I have created a routine that when
> passed a string, and parameters, will call OSAExecuteEvent for the
> subroutine specified in the string, with the passed in parameters. I'm
> pretty sure there is no problem with the creating the scripting
> component, or loading the script as I can use OSAExecute without any
> problems. Here is my routine: ...
>
> <<snip>>

> where inEvent is the string parameter with the sub's name, inParameters
> is an AEList with the parameters. The rest of the variables are
> hopefully self explanatory. For my testing I'm just using a subroutine
> that has no parameters, so the list is empty. The script itself looks
> like:
> on mySubroutine()
> ....
> end mySubroutine
>
One thing to be aware of is that unlike calls from inside a script
itself, the subroutine name for the subroutine event is case-sensitive
and must match the handler name in the script as compiled.

> I also went ahead and created an event in my 'aete' resource, and
> created the AppleEvent with its suite and event code, and modified the
> script appropriately and I still got the same error.

Aaah, that's a problem. If you define terminology and use it, you must
send the event using the four-character codes defined in terminology;
the by-name 'psbr' event only works for handlers for which no terms are
defined.

Try either removing the terminology and using the correct case in the
'psbr' event, or removing the terminology, quitting all AppleScript
clients (to flush the terminology cache), and building an event that
uses the four-character codes you define instead of the 'psbr' event.

Chris




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.