<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Automator",
  "identifier" : "/documentation/Automator/AMAction/run(withInput:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Automator"
    ],
    "preciseIdentifier" : "c:objc(cs)AMAction(im)runWithInput:error:"
  },
  "title" : "run(withInput:)"
}
-->

# run(withInput:)

Requests the action to perform its task using the specified input.

```
func run(withInput input: Any?) throws -> Any
```

## Parameters

`input`

The input for the receiving action. Should contain one or more objects compatible with one of the types specified in the action’s [`selectedInputType`](/documentation/Automator/AMAction/selectedInputType) property.

## Return Value

An <doc://com.apple.documentation/documentation/Foundation/NSArray> object that contains one or more objects of a data type compatible with a type specified in the receiving action’s `AMProvides` property. If the action doesn’t modify the data passed in `input`, it should return it unchanged. If the action doesn’t have any data to provide, it should return an empty <doc://com.apple.documentation/documentation/Foundation/NSArray> object.

## Discussion

This method is intended to be overridden.

The input and output objects for actions are usually instances of <doc://com.apple.documentation/documentation/Foundation/NSArray>. If the action encounters problems, it should return by indirection an <doc://com.apple.documentation/documentation/Foundation/NSError> object that describes the error.

---

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)