I have a simple small text editor that implements the editor part of Apple Events ODBEditorSuite so that my app can work on Working with Quickcaster to provide editing capabilities. The events that need to be sent are very straightforward and share a lot of code, so I wrapped it in a method like this: So, I'm not sure that to go out of it,
- (BOOL) postODBEditorAppleEvent: (OSType (NSString *) type oldPath newLocation :) withOldLocation (NSString *) Newpath {NSData * targetBundleID = [@ "com.hogbaysoftware.QuickCursor" dataUsingEncoding: NSUTF8StringEncoding]; NSAppleEventDescriptor * targetDescriptor = [NSAppleEventDescriptor Discripters With Discriptio Type: ApplicationBundleID Data: targetBundleID]; NSAppleEventDescriptor * appleEvent = [NSAppleEventDescriptor appleEventWithEventClass: kODBEditorSuite eventID: Type targetDescriptor: targetDescriptor returnID: kAutoGenerateReturnID transactionId: kAnyTransactionID]; NSAppleEventDescriptor * directObjectDescriptor = [NSAppleEventDescriptor DiscriptorWithDescriptorType: typeFSRef Data: [oldPath dataUsingEncoding: NSUTF8StringEncoding]]; [AppleEvent setParamDescriptor: directObjectDescriptor forKeyword: keyDirectObject]; If (newpath! = Zero) {NSAppleEventDescriptor * newLocationDescriptor = [NSAppleEventDescriptor descriptor with special type of type: typefspr data: [newpath data device encoding: NSUTF8StringEncoding]]; [AppleEventSetPraamsDiscriptors: Keywords for New Location Descriptors: Main Newlation]; } If (self.senderToken = zero!) {NSAppleEventDescriptor * tokenDescriptor = [NSAppleEventDescriptor DiscriptorWithDescriptorType: typeWildCard Data: self.senderToken]; [AppleEvent setParamDescriptor: Keywords for Tokens Descriptors: KeyCardToken]; } If (self.customPath! = Zero) {NSData * customPathData = self.customPath; NSAppleEventDescriptor * customPathDescriptor = [NSAppleEventDescriptor descriptor with decryptor type: TypNoedEdtext data: custompathdata]; [AppleEvent setParamDescriptor: customPathDescriptor forKeyword: keyFileCustomPath]; } AEDSC answer = {Type faucet, Nouvel}; Ossatatus status = noir; Status = AESend ([appleEvent aeDesc], and North, KAIAAT, KNormalPrarity, KAdfaltT timefant, Nouel, Null); Return status == noir; }
Using NSLog ()
debugging, I have confirmed that Apple is sending the event and as far as I can tell the direct object descriptor to the appropriate data . But, on the quick cursor side, I continue to see messages like 5/17/10 12:41:15 PM QuickCursor [177] An ODB editor's event was found for the unknown file.
in console.app I have created QuickCursor from the source and are able to ensure that it is not getting the proper path from the direct object descriptor. NSAppleEventDescriptor
is quite foreign to me and the old school smells of gray beer :-P but I Would be better trained to hear this kind of mantra and maybe I was expecting to talk to me doing what was wrong. thank you in advanced.
I'm not sure why, but is using [NSAppleEventDescriptor descriptorWithString: oldPath ]
worked fine that have gone to debug anymore and other things, maybe it helps someone else.
Comments
Post a Comment