I wrote an application that can be scriptable using AppleScript. Now I can write the next thing in AppleScript editor:
tell application "My Magazines"
current magazine
end tell
It returns the following response:
«class » "The NY Times" of application "My Magazines"
The response is okay. I can extract properties of it and use methods defined in the magazine
class. The only thing that bothers me is «class »
, which is not quite human readable. I tried to find the method I need to override to provide users with better description of the method, but couldn't find one.
Is there a method I can override to replace «class » "The NY Times"
with something like Magazine "The NY Times"
?
magazine
is defined as following in my sdef-file:
<class name="magazine" code="sMAG" description="A particular magazine">
<cocoa class="MyMagazine" />
<property name="name" code="pnam" type="text" access="r" description="Title of it">
<cocoa key="name" />
</property>
</class>
The class itself is defined as:
@interface MyMagazine : NSObject
{
NSString *name;
}
@property (nonatomic, readonly) NSString *name;
@end
And implemented like:
@implementation MyMagazine
@synthesize name;
- (NSScriptObjectSpecifier *)objectSpecifier
{
MyMagazinesList *list = [MyMagazinesList sharedList];
return [[[NSNameSpecifier alloc] initWithContainerClassDescription:(NSScriptClassDescription *)[[list objectSpecifier] keyClassDescription]
containerSpecifier:[list objectSpecifier]
key:@"magazines"
name:name] autorelease];
}