Instance Method

initWithURL:error:

Return a user script task instance given a URL for a script file.

Declaration

- (instancetype)initWithURL:(NSURL *)url error:(NSError * _Nullable *)error;

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.

See Also

Specifying the Script

scriptURL

The URL of the script file.