NSNameSpecifier Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in OS X v10.2 and later. |
| Companion guide | |
| Declared in | NSScriptObjectSpecifiers.h |
Overview
Specifies an object in a collection (or container) by name. For example, the following script specifies both an application and a window by name. In this script, the named window’s implicitly specified container is the Finder application’s list of open windows.
tell application "Finder" -- specifies an application by name |
close window "Reports" -- specifies a window by name |
end tell |
This specifier works only for objects that have a name property. You don’t normally subclass NSNameSpecifier.
The evaluation of an instance of NSNameSpecifier follows these steps until the specified object is found:
If the container implements a method whose selector matches the relevant
valueIn<Key>WithName:pattern established by scripting key-value coding, the method is invoked. This method can potentially be very fast, and it may be relatively easy to implement.As is the case when evaluating any script object specifier, the container of the specified object is given a chance to evaluate the object specifier. If the container class implements the
indicesOfObjectsByEvaluatingObjectSpecifiermethod, the method is invoked. This method can potentially be very fast, but it is relatively difficult to implement.An instance of
NSWhoseSpecifierthat specifies the first object whose relevant'pnam'attribute matches the name is synthesized and evaluated. The instance ofNSWhoseSpecifiermust search through all of the keyed elements in the container, looking for a match. The search is potentially very slow.
Instance Methods
initWithContainerClassDescription:containerSpecifier:key:name:
Invokes the super class’s initWithContainerClassDescription:containerSpecifier:key: method and then sets the name instance variable to name.
Availability
- Available in OS X v10.2 and later.
Declared In
NSScriptObjectSpecifiers.hname
Returns the name encapsulated by the receiver for the specified object in the container.
Availability
- Available in OS X v10.2 and later.
See Also
Declared In
NSScriptObjectSpecifiers.h© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)