setEventHandler not working! (AppleScript related)
setEventHandler not working! (AppleScript related)
- Subject: setEventHandler not working! (AppleScript related)
- From: Daniel Morrow <email@hidden>
- Date: Mon, 21 Feb 2005 11:15:40 -0500
OK, I have a Cocoa app that I'm working on. It's a very simple app that is only used in-house. And there's only one AppleEvent that I need to handle.
The way it works, (just for some background, not too important) when the user clicks a button in FileMaker, it launches an AppleScript. This AppleScript sends one event to my app, and my app does stuff. Very simple.
So, what I've done so far:
- in my "Info.plist" file, I've added the "NSAppleScriptEnabled" flag and set it to "YES"
- I've created an 'aete' resource with my custom event in it. This is an 'aete' resource instead of a "scriptSuite" file, because I couldn't get the "Script Editor" to recognize my app as scriptable. But when it's an 'aete' resource it does. I've seen some other apps do this, like TextWrangler, so it must be OK to do.
- lastly, in my code, I do something like this,
<x-tad-smaller>[[NSAppleEventManager sharedAppleEventManager] setEventHandler:</x-tad-smaller><x-tad-smaller>self</x-tad-smaller><x-tad-smaller>
</x-tad-smaller><x-tad-smaller> andSelector:</x-tad-smaller><x-tad-smaller>@selector</x-tad-smaller><x-tad-smaller>(upgradeHandler:withReply:)
forEventClass:</x-tad-smaller><x-tad-smaller>'Cust'</x-tad-smaller><x-tad-smaller> andEventID:</x-tad-smaller><x-tad-smaller>'Upgr'</x-tad-smaller><x-tad-smaller>];
</x-tad-smaller>And my handler looks like this:
<x-tad-smaller>
</x-tad-smaller><x-tad-smaller>- (</x-tad-smaller><x-tad-smaller>void</x-tad-smaller><x-tad-smaller>) upgradeHandler:(NSAppleEventDescriptor*)event withReply:(NSAppleEventDescriptor*)reply;
</x-tad-smaller>
Right now, I'm just running from script from Script Editor. And I have a breakpoint in my routine, but it never gets there, and all I get is this lousy message:
AppleScript Error
"AppX got an error: Can't continue Upgrade."
where Upgrade is the name for my custom AppleEvent.
This is driving me crazy! Is there any kind of AppleEvent debugging or something? I just wish I knew where the event is going.
Thanks for any help in this matter,
-Dan.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden