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



Chris,

I've been having the same problem as Micah, and have talked to Mark Piccirelli about it a couple of times. Last word, was that he wasn't entirely familiar with OSA, and was going to pass along my request for a similar technote to Q1026 to detail how to call a subroutine in an AppleScript from an application.

Because I had several problems with AppleScript, I had created a simple piece of sample code to test the various OSA methods.

I have attached the most recent version, If you're interested in trying it out. To test the problem, that Micah and I are having:

1) Select the choose button, and choose the "ScriptTest command test" file from the included scripts folder.
2) Click the "linear" button in the second section to attempt to execute function1.

For break points, the method that gets called behind the "Linear" button is the linearRunCommand2:inScript:withParamaterList: and resides in VScript_LinearAdditions.m

The only difference between the first two methods in that file, are that one calls OSAExecuteEvent and the other calls OSADoEvent. Both end up returning -1708.

I did attempt to add a command to the Widget class, but not for the 'funtion1' test method. This stuff used to work under OS 9, and is quickly becoming a major road block. Any help you could provide on this, would be wonderful. I'm about to make bundles the only form of expansion, but I'd really like to do it through AppleScript if I could.

Cheers,
Brant


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


--__--__--

_______________________________________________
applescript-implementors mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/applescript-implementors


End of applescript-implementors Digest




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.