Re: Apple Event parameter types in Cocoa scripting
Re: Apple Event parameter types in Cocoa scripting
- Subject: Re: Apple Event parameter types in Cocoa scripting
- From: Martin Wierschin <email@hidden>
- Date: Fri, 14 Aug 2009 15:15:10 -0700
I'm trying to add an Apple Event to my Cocoa application that
accepts a pure data parameter (AE constant typeData = 'tdta'). In
my ".scriptSuite" file I've tried setting the "Type" to "NSData",
"NSAppleEventDescriptor", "tdta", "any", and "****". All of them
trigger something like the following log output on launch:
.scriptSuite warning for argument 'xxxx' of command 'Whatever' in
suite 'MyApp': 'NSData' is not a valid type name.
It turns out I can work around this without resorting to installing
Carbon event handlers. Just omit the parameter from the script suite
file and in the NSScriptCommand subclass use this addition:
@implementation NSScriptCommand (MYAdditions)
- (NSData*) dataParameterForKeyword:(AEKeyword)key
{
NSAppleEventDescriptor* paramDesc = [[self appleEvent]
paramDescriptorForKeyword:key];
if( (nil == paramDesc) || (typeData != [paramDesc descriptorType]) )
return nil;
return [paramDesc data];
}
@end
But I'd still be interested in knowing the answer to:
How do I get Cocoa to give me an instance of NSData in the
"evaluatedArguments" dictionary?
~Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden