Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/Foundation.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSScriptExecutionContext.h |
Related sample code |
An NSScriptExecutionContext
object is a shared instance (there is only one instance of the class) that represents the context in which the current script command is executed. NSScriptExecutionContext
tracks global state relating to the command being executed, especially the top-level container object (that is, the container implied by a specifier object that specifies no container) used in an evaluation of an NSScriptObjectSpecifier
object.
In most cases, the top-level container for a complete series of nested object specifiers is automatically set to the application object (NSApp
), and you can get this object with the topLevelObject
method. But you can also set this top-level container to something else (using setTopLevelObject:
) if the situation warrants it.
It is unlikely that you will need to subclass NSScriptExecutionContext
.
– topLevelObject
– setTopLevelObject:
– objectBeingTested
– setObjectBeingTested:
– rangeContainerObject
– setRangeContainerObject:
Returns the shared NSScriptExecutionContext
instance.
+ (NSScriptExecutionContext *)sharedScriptExecutionContext
The shared NSScriptExecutionContext
instance, creating it first if it doesn’t exist.
NSScriptExecutionContext.h
Returns the top-level container object currently being tested in a “whose” qualifier.
- (id)objectBeingTested
The top-level container object currently being tested in a “whose” qualifier. Returns nil
if such an object does not exist.
– setObjectBeingTested:
containerIsObjectBeingTested
(NSScriptObjectSpecifier) NSScriptExecutionContext.h
Returns the top-level container object for an object specifier (encapsulated in an NSRangeSpecifier
object) that represents the first or last element in a range of elements.
- (id)rangeContainerObject
The top-level container object for an object specifier (encapsulated in an NSRangeSpecifier
object) that represents the first or last element in a range of elements.
NSScriptExecutionContext.h
Sets the top-level container object currently being tested in a “whose” qualifier to a given object.
- (void)setObjectBeingTested:(id)object
The top-level container object currently being tested.
NSScriptExecutionContext.h
Sets the top-level container object for a range-specifier evaluation to a give object.
- (void)setRangeContainerObject:(id)container
The top-level container object for a range-specifier evaluation.
Instances of NSRangeSpecifier
contain object specifiers representing the first or last element in a range of elements, and these specifiers are evaluated in the context of container.
NSScriptExecutionContext.h
Sets the top-level object for an object-specifier evaluation.
- (void)setTopLevelObject:(id)anObject
The top-level object for an object-specifier evaluation.
NSScriptExecutionContext.h
Returns the top-level object for an object-specifier evaluation.
- (id)topLevelObject
The top-level object for an object-specifier evaluation.
For applications, this object is automatically set to the application object, but can be set to some other container object.
NSScriptExecutionContext.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)