• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Apple Event parameter types in Cocoa scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Apple Event parameter types in Cocoa scripting (From: Martin Wierschin <email@hidden>)

  • Prev by Date: Apple Event parameter types in Cocoa scripting
  • Next by Date: CTLineCreateWithAttributedString ignoring font size
  • Previous by thread: Apple Event parameter types in Cocoa scripting
  • Next by thread: CTLineCreateWithAttributedString ignoring font size
  • Index(es):
    • Date
    • Thread