NSUserScriptTask Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in OS X v10.8 and later. |
| Declared in | NSUserScriptTask.h |
Overview
The NSUserScriptTask class is an abstract class that is able to run all the scripts normally run by the one of its subclasses, however it ignores the results.. It is intended to execute user-supplied scripts and will execute them outside of the application's sandbox, if any.
If you need to execute scripts and get the input and output information use the NSUserUnixTask, NSUserAppleScriptTask, and NSUserAutomatorTask sub classes.
Instance Methods
executeWithCompletionHandler:
Executes the script with no input and ignoring any result.
Parameters
- handler
The completion handler Block that returns the result or an error. See
NSUserScriptTaskCompletionHandler.
Discussion
This method should be invoked no more than once for a given instance of the class.
If the script completed normally, the completion handler's error parameter will be nil.
Availability
- Available in OS X v10.8 and later.
See Also
Declared In
NSUserScriptTask.hinitWithURL:error:
Return a user script task instance given a URL for a script file.
Parameters
- url
The script URL.
- error
A return by-reference error that specifies any error in loading the script.
Return Value
An instance of an NSUserScriptTask subclass or nil if the file does not appear to match any of the known types.
Discussion
The returned object will be of one of the specific sub-classes (NSUserUnixTask, NSUserAppleScriptTask, and NSUserAutomatorTask), or nil if the file does not appear to match any of the known types.
If invoked from a subclass, the result will be that class or nil.
Availability
- Available in OS X v10.8 and later.
See Also
Declared In
NSUserScriptTask.hscriptURL
The URL of the script file.
Return Value
The URL of the script file.
Availability
- Available in OS X v10.8 and later.
See Also
Declared In
NSUserScriptTask.hConstants
NSUserScriptTaskCompletionHandler
Implement this block to retrieve the error of the script executed by executeWithCompletionHandler:.
typedef void (^NSUserScriptTaskCompletionHandler)(NSError *error);
Availability
- Available in OS X v10.8 and later.
Declared In
NSUserScriptTask.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-07-23)