NSScriptExecutionContext Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSScriptExecutionContext.h |
Overview
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.
Class Methods
sharedScriptExecutionContext
Returns the shared NSScriptExecutionContext instance.
Return Value
The shared NSScriptExecutionContext instance, creating it first if it doesn’t exist.
Availability
- Available in OS X v10.0 and later.
Declared In
NSScriptExecutionContext.hInstance Methods
objectBeingTested
Returns the top-level container object currently being tested in a “whose” qualifier.
Return Value
The top-level container object currently being tested in a “whose” qualifier. Returns nil if such an object does not exist.
Availability
- Available in OS X v10.0 and later.
See Also
-
– setObjectBeingTested: -
containerIsObjectBeingTested(NSScriptObjectSpecifier)
Declared In
NSScriptExecutionContext.hrangeContainerObject
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.
Return Value
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.
Availability
- Available in OS X v10.0 and later.
Declared In
NSScriptExecutionContext.hsetObjectBeingTested:
Sets the top-level container object currently being tested in a “whose” qualifier to a given object.
Parameters
- object
The top-level container object currently being tested.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSScriptExecutionContext.hsetRangeContainerObject:
Sets the top-level container object for a range-specifier evaluation to a give object.
Parameters
- container
The top-level container object for a range-specifier evaluation.
Discussion
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.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSScriptExecutionContext.hsetTopLevelObject:
Sets the top-level object for an object-specifier evaluation.
Parameters
- anObject
The top-level object for an object-specifier evaluation.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSScriptExecutionContext.htopLevelObject
Returns the top-level object for an object-specifier evaluation.
Return Value
The top-level object for an object-specifier evaluation.
Discussion
For applications, this object is automatically set to the application object, but can be set to some other container object.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSScriptExecutionContext.h© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)