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

# runWithInput:fromAction:error:

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

```
- (id) runWithInput:(id) input fromAction:(AMAction *) anAction error:(NSDictionary<NSString *,id> **) errorInfo;
```

## Parameters

`input`

The input for the receiving action. By default, actions can only accept and provide the following types. However, by overriding this method, you can change the types your action can use:

- Objective-C actions: Accepts and provides types must inherit from `com.apple.cocoa.string`, `com.apple.cocoa.path`, `com.apple.cocoa.url`, or `com.apple.cocoa.data`.
- Shell script actions: Accepts and provides types must inherit from `com.apple.cocoa.string` or `com.apple.cocoa.data`.
- AppleScript actions: Accepts and provides types must inherit from `com.apple.applescript.object`.

`anAction`

The action from which the `input` object was obtained.

`errorInfo`

If an error occurs, the action returns an error dictionary in this parameter. The keys and values for this dictionary are:

- `OSAScriptErrorNumber` (a string constant) — The value for this key is an instance of <doc://com.apple.documentation/documentation/Foundation/NSNumber> whose integer value indicates an error code. See the header file `MacErrors.h` in the Carbon Core framework for a list of valid error codes, particularly the section on OSA errors.
- `OSAScriptErrorMessage` (a string constant) —The value for this key is an instance of <doc://com.apple.documentation/documentation/Foundation/NSString> describing the error.

## Return Value

An object containing 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.

## Discussion

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 error dictionary that describes the error.

This method is intended to be overridden. AppleScript actions, however, usually will not need to override this method because the same functionality is provided by an AppleScript script.

---

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)