Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSScriptCommandDescription help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSScriptCommandDescription help



Thanks for your response.
 
I want to expose some commands for testing for which I am doing this.
 
- Kunal

On Feb 5, 2010, at 13:37, Christiaan Hofman <email@hidden> wrote:

This class is not meant for registering your script command. You should use an .sdef for that. NSScriptCommandDescription instances are created for you automatically by the registry system, you should never need to initialize one yourself.

Christiaan

On Feb 5, 2010, at 19:44, Kunal Parmar wrote:

I am trying to install a command using -[NSScriptCommandDescription initWithSuiteName:commandName:dictionary:]. This method has very little documentation and after a lot of trial and error, I have finally been able to get something going. Currently, I am stuck because Cocoa is not recognizing the type of the arguments to this command. Here's the code:

NSDictionary *directParameter =[NSDictionary dictionaryWithObjectsAndKeys:
@"NSString", @"Type",
@"----", @"AppleEventCode", nil];
NSDictionary *myCommandArguments = [NSDictionary dictionaryWithObjectsAndKeys:
  directParameter, @"", nil];

NSDictionary *myCommandDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
@"MyCommandClass", @"CommandClass",
@"foo ", @"AppleEventCode",
@"bar ", @"AppleEventClassCode",
@"NSArray class]", @"Type", @"list", @"ResultAppleEventCode",
myCommandArguments, @"Arguments",nil];
NSScriptCommandDescription *myCommand = [[[NSScriptCommandDescription alloc] initWithSuiteName:@"My Suite"
 commandName:@"foobar"
  dictionary:myCommandDictionary] autorelease];



When I log myCommand to console, I get:

Command: foobar ('bar '/'foo ')
    Implementation class: MyCommandClass
    Name: <none>, description: <none>
    Unnamed argument ('----'), type: (null) (''), optional: no
        (No user-readable name or description needed for unnamed arguments)
    Result type: NSArray ('null')
        Description: <none>


Am I doing something wrong here?

Thanks.

- Kunal
Do not post admin requests to the list. They will be ignored. Applescript-implementors mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSScriptCommandDescription help (From: Kunal Parmar <email@hidden>)
 >Re: NSScriptCommandDescription help (From: Christiaan Hofman <email@hidden>)



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.