Mac Developer Library

Developer

Foundation Framework Reference NSScriptClassDescription Class Reference

Options
Deployment Target:

On This Page
Language:

NSScriptClassDescription

An instance of NSScriptClassDescription describes a script class that a Cocoa application supports. More...

Inheritance


Conforms To


Import Statement


import Foundation @import Foundation;

Availability


Available in OS X v10.0 and later.
  • Initializes and returns a newly allocated instance of NSScriptClassDescription.

    Declaration

    Swift

    init?(suiteName suiteName: String, className className: String, dictionary classDeclaration: [NSObject : AnyObject]?)

    Objective-C

    - (instancetype)initWithSuiteName:(NSString *)suiteName className:(NSString *)className dictionary:(NSDictionary *)classDeclaration

    Parameters

    suiteName

    The name of the suite (in the application’s scriptability information) that the class belongs to. For example, "AppName Suite".

    className

    The name of the class that this instance describes.

    classDeclaration

    A class declaration dictionary of the sort that is valid in script suite property list files. This dictionary provides information about the class such as its attributes and relationships.

    Return Value

    The initialized instance. Returns nil if the event code value for the class description itself is missing or is not an NSString. Also returns nil if the superclass name or any of the subdictionaries of descriptions are not of the right type.

    Discussion

    This method registers self with the application’s global instance of NSScriptSuiteRegistry.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the class description for the specified class or, if it is not scriptable, for the first superclass that is.

    Declaration

    Swift

    init?(forClass aClass: AnyClass!) -> NSScriptClassDescription

    Objective-C

    + (NSScriptClassDescription *)classDescriptionForClass:(Class)aClass

    Parameters

    aClass

    The class whose description is needed.

    Return Value

    The class description for the class specified by aClass or, if that class isn’t scriptable, for the class description for the first superclass that is. Returns nil if it doesn’t find a scriptable class.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.5 and later.

  • Returns the class description instance for the class type of the specified attribute or relationship.

    Declaration

    Swift

    func classDescriptionForKey(_ key: String) -> NSScriptClassDescription?

    Objective-C

    - (NSScriptClassDescription *)classDescriptionForKey:(NSString *)key

    Parameters

    key

    The identifying key for an attribute or relationship of the receiver.

    Return Value

    The instance of NSScriptClassDescription for the type of the attribute or relationship specified by key. Returns nil if no scriptable property corresponds to key.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the class description instance for the superclass of the receiver’s class.

    Declaration

    Swift

    var superclassDescription: NSScriptClassDescription? { get }

    Objective-C

    @property(readonly, retain) NSScriptClassDescription *superclassDescription

    Return Value

    A class description instance that describes the superclass of the receiver’s class. Returns nil if the class has no superclass.

    Discussion

    The instance of NSScriptClassDescription that describes the superclass can be in the same suite as the receiver or in a different suite.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the name of the class the receiver describes, as provided at initialization time.

    Declaration

    Swift

    var className: String? { get }

    Objective-C

    @property(readonly, copy) NSString *className

    Return Value

    A class name. This may be either the human-readable name for the class—that is, the name that is used in a script—or the name of the Objective-C class that is instantiated to implement the class. To reliably obtain the implementation name, use implementationClassName.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

    See Also

    – suiteName

  • Returns the value of the DefaultSubcontainerAttribute entry of the class dictionary from which the receiver was instantiated.

    Declaration

    Swift

    var defaultSubcontainerAttributeKey: String? { get }

    Objective-C

    @property(readonly, copy) NSString *defaultSubcontainerAttributeKey

    Return Value

    The value of the default subcontainer attribute entry. Returns nil if the there was no such entry.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.2 and later.

  • Returns the name of the Objective-C class instantiated to implement the scripting class.

    Declaration

    Swift

    var implementationClassName: String? { get }

    Objective-C

    @property(readonly, copy) NSString *implementationClassName

    Return Value

    An Objective-C class name.

    Discussion

    The name returned by the className method for an instance of NSScriptClassDescription resulting from an sdef class declaration is the human-readable name for the class—that is, the name that is used in a script. To obtain the name of the Objective-C class instantiated to implement the class, use implementationClassName.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.5 and later.

  • Returns a Boolean value indicating whether an insertion location must be specified when creating a new object in the specified to-many relationship of the receiver.

    Declaration

    Swift

    func isLocationRequiredToCreateForKey(_ toManyRelationshipKey: String) -> Bool

    Objective-C

    - (BOOL)isLocationRequiredToCreateForKey:(NSString *)toManyRelationshipKey

    Parameters

    toManyRelationshipKey

    The key for the to-many relationship that may require an insertion location.

    Return Value

    YEStrue if an insertion location must be specified; otherwise, NOfalse.

    Discussion

    A script command object that creates a new object in a to-many relationship needs to know whether an explicitly specified insertion location is required. It can get this information from an instance of NSScriptClassDescription. For example, NSMakeCommand uses this method to determine whether or not a specific make AppleScript command must have an at parameter.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.2 and later.

  • Returns the name of the receiver’s suite.

    Declaration

    Swift

    var suiteName: String? { get }

    Objective-C

    @property(readonly, copy) NSString *suiteName

    Return Value

    The receiver’s suite name. Within an application’s scriptability information, named suites contain related sets of information.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

    See Also

    – className

  • Returns the Apple event code associated with the receiver’s class.

    Declaration

    Swift

    var appleEventCode: FourCharCode { get }

    Objective-C

    @property(readonly) FourCharCode appleEventCode

    Return Value

    The Apple event code associated with the receiver’s class. This is the primary code used to identify the class in Apple events.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the Apple event code for the specified attribute or relationship in the receiver.

    Declaration

    Swift

    func appleEventCodeForKey(_ key: String) -> FourCharCode

    Objective-C

    - (FourCharCode)appleEventCodeForKey:(NSString *)key

    Parameters

    key

    The identifying key for an attribute or relationship of the receiver.

    Return Value

    The four-character Apple event code associated with the attribute or relationship identified by key in the receiver or, if none exists, in the class description for the receiver’s superclass. Returns 0 if no such attribute or relationship is found.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value indicating whether a primary or secondary Apple event code in the receiver matches the passed code.

    Declaration

    Swift

    func matchesAppleEventCode(_ appleEventCode: FourCharCode) -> Bool

    Objective-C

    - (BOOL)matchesAppleEventCode:(FourCharCode)appleEventCode

    Parameters

    appleEventCode

    An Apple event code to compare against the receiver’s primary or secondary codes.

    Return Value

    YEStrue if the receiver’s primary four-character Apple event code or any of its secondary codes (its synonyms) matches code; otherwise, NOfalse.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value indicating whether the described class has an ordered to-many relationship identified by the specified key.

    Declaration

    Swift

    func hasOrderedToManyRelationshipForKey(_ key: String) -> Bool

    Objective-C

    - (BOOL)hasOrderedToManyRelationshipForKey:(NSString *)key

    Parameters

    key

    The identifying key for a property of the receiver.

    Return Value

    YEStrue if the described class has an ordered to-many relationship identified by the specified key; otherwise, NOfalse.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.5 and later.

  • Returns a Boolean value indicating whether the described class has a property identified by the specified key.

    Declaration

    Swift

    func hasPropertyForKey(_ key: String) -> Bool

    Objective-C

    - (BOOL)hasPropertyForKey:(NSString *)key

    Parameters

    key

    The identifying key for a property of the receiver.

    Return Value

    YEStrue if the described class has a property identified by the specified key; otherwise, NOfalse.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.5 and later.

  • Returns a Boolean value indicating whether the described class has a readable property identified by the specified key.

    Declaration

    Swift

    func hasReadablePropertyForKey(_ key: String) -> Bool

    Objective-C

    - (BOOL)hasReadablePropertyForKey:(NSString *)key

    Parameters

    key

    The identifying key for a property of the receiver.

    Return Value

    YEStrue if the described class has a readable property identified by the specified key; otherwise, NOfalse.

    Discussion

    To determine if a property is read-only, invoke hasWritablePropertyForKey:/

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.5 and later.

  • Returns a Boolean value indicating whether the described class has a writable property identified by the specified key.

    Declaration

    Swift

    func hasWritablePropertyForKey(_ key: String) -> Bool

    Objective-C

    - (BOOL)hasWritablePropertyForKey:(NSString *)key

    Parameters

    key

    The identifying key for a property of the receiver.

    Return Value

    YEStrue if the described class has a writable property identified by the specified key; otherwise, NOfalse.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.5 and later.

  • Returns a Boolean value indicating whether a specified property in the receiver is read-only.

    Deprecation Statement

    Use hasWritablePropertyForKey: instead.

    Declaration

    Objective-C

    - (BOOL)isReadOnlyKey:(NSString *)key

    Parameters

    key

    The identifying key for a property of the receiver.

    Return Value

    YEStrue if the property specified by key exists in the receiver or in the NSScriptClassDescription for any superclass, and is read only; otherwise, NOfalse.

    Special Considerations

    This method could return NOfalse either because key is unrecognized or because writing to the property is not supported. Use hasWritablePropertyForKey: instead.

    Import Statement

    Availability

    Available in in OS X v10.0.

    Deprecated in OS X v10.5.

  • Given an Apple event code that identifies a property or element class, returns the key for the corresponding attribute, one-to-one relationship, or one-to-many relationship.

    Declaration

    Swift

    func keyWithAppleEventCode(_ appleEventCode: FourCharCode) -> String?

    Objective-C

    - (NSString *)keyWithAppleEventCode:(FourCharCode)appleEventCode

    Parameters

    appleEventCode

    An Apple event code that identifies a property or element class.

    Return Value

    The key that corresponds to the property or element class identified by appleEventCode in the receiver or, if none exists, in a class description in the receiver’s superclasses.

    The four-character Apple event code associated with the attribute or relationship identified by key Returns 0 if no such attribute or relationship is found. Returns nil if it cannot find any such attribute or relationship.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the name of the declared type of the attribute or relationship identified by the passed key.

    Declaration

    Swift

    func typeForKey(_ key: String) -> String?

    Objective-C

    - (NSString *)typeForKey:(NSString *)key

    Parameters

    key

    The identifying key for an attribute, one-to-one relationship, or one-to-many relationship of the receiver.

    Return Value

    The name of the declared type of the attribute or relationship identified by key; for example, “NSString”. Searches in the receiver first, then in any superclass. Returns nil if no match is found.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns the selector associated with the receiver for the specified command description.

    Declaration

    Swift

    func selectorForCommand(_ commandDescription: NSScriptCommandDescription) -> Selector

    Objective-C

    - (SEL)selectorForCommand:(NSScriptCommandDescription *)commandDescription

    Parameters

    commandDescription

    A description for a script command, such as duplicate, make, or move. Encapsulates the scriptability information for that command, such as its Objective-C selector, its argument names and types, and its return type (if any).

    Return Value

    The selector from the receiver for the command specified by commandDescription. Searches in the receiver first, then in any superclass. Returns NULL if no matching selector is found.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.

  • Returns a Boolean value indicating whether the receiver or any superclass supports the specified command.

    Declaration

    Swift

    func supportsCommand(_ commandDescription: NSScriptCommandDescription) -> Bool

    Objective-C

    - (BOOL)supportsCommand:(NSScriptCommandDescription *)commandDescription

    Parameters

    commandDescription

    A description for a script command, such as duplicate, make, or move. Encapsulates the scriptability information for that command, such as its Objective-C selector, its argument names and types, and its return type (if any).

    Return Value

    YEStrue if an the receiver or the instance of NSScriptClassDescription of any superclass of the receiver’s class lists the command described by commandDesc among its supported commands; otherwise, NOfalse.

    Import Statement

    import Foundation

    Availability

    Available in OS X v10.0 and later.