<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSUserAutomatorTask",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUserAutomatorTask"
  },
  "title" : "NSUserAutomatorTask"
}
-->

# NSUserAutomatorTask

An object that executes Automator workflows.

```
class NSUserAutomatorTask
```

## Overview

The [`NSUserAutomatorTask`](/documentation/Foundation/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 [`Process`](/documentation/Foundation/Process) or <doc://com.apple.documentation/documentation/Automator/AMWorkflow> classes.  If the application is sandboxed, then the script must be in the [`FileManager.SearchPathDirectory.applicationScriptsDirectory`](/documentation/Foundation/FileManager/SearchPathDirectory/applicationScriptsDirectory) 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`](/documentation/Foundation/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.

## Topics

### Executing Automator Tasks

[`-  executeWithInput:completionHandler:`](/documentation/Foundation/NSUserAutomatorTask/execute(withInput:completionHandler:))

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

[`variables`](/documentation/Foundation/NSUserAutomatorTask/variables)

The variables required by the Automator workflow.

### Constants

[`CompletionHandler`](/documentation/Foundation/NSUserAutomatorTask/CompletionHandler)

Implement this block to retrieve the output of the Automator workflow executed by [`execute(withInput:completionHandler:)`](/documentation/Foundation/NSUserAutomatorTask/execute(withInput:completionHandler:)).

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Sendable`](/documentation/Swift/Sendable)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherits From

[`NSUserScriptTask`](/documentation/Foundation/NSUserScriptTask)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)