Mac Developer Library

Developer

Foundation Framework Reference NSUserAutomatorTask Class Reference

Options
Deployment Target:

On This Page
Language:

NSUserAutomatorTask

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.8 and later.

The NSUserAutomatorTask class is intended to run Automator workflows from your application. It is intended to execute user-supplied workflows, and will execute them outside of the application's sandbox, if any.

The class is not intended to execute scripts built into an application; for that, use one of the NSTask or AMWorkflow classes. If the application is sandboxed, then the script must be in the NSApplicationScriptsDirectory folder. A sandboxed application may read from, but not write to, this folder.

If you simply need to execute scripts without regard to input or output, use NSUserScriptTask, which can execute any of the specific types. If you need specific control over the input to or output from the workflow, use this class.

  • Execute the Automator workflow by providing it as securely coded input.

    Declaration

    Swift

    func executeWithInput(_ input: NSSecureCoding?, completionHandler handler: NSUserAutomatorTaskCompletionHandler!)

    Objective-C

    - (void)executeWithInput:(id<NSSecureCoding>)input completionHandler:(NSUserAutomatorTaskCompletionHandler)handler

    Parameters

    input

    The automator task.

    handler

    The completion handler Block that returns the result or an error. See NSUserAutomatorTaskCompletionHandler.

    Discussion

    The Automator workflow will execute using the variables property values.

    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.

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

    See Also

    – initWithURL:error: (NSUserScriptTask)
    variables

  • variables variables Property

    The variables required by the Automator workflow.

    Declaration

    Swift

    var variables: [NSObject : AnyObject]?

    Objective-C

    @property(copy) NSDictionary *variables

    Import Statement

    Objective-C

    @import Foundation;

    Swift

    import Foundation

    Availability

    Available in OS X v10.8 and later.

Data Types