Instance Method


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


- (id)runWithInput:(id)input error:(NSError * _Nullable *)error;



The input for the receiving action. Should contain one or more objects compatible with one of the types specified in the action’s AMAccepts property.


If an error occurs, the action returns an NSError object in this parameter. For actions running AppleScript code, the following keys may be specified in the userInfo property of NSError, and they will be honored.

  • OSAScriptErrorNumber (a string constant) — The value for this key is an instance of 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 NSString describing the error.

Return Value

An NSArray object containing one or more objects of a data type compatible with a type specified in the receiving action’s AMProvides property. If the receiver does not modify the data passed in input, it should return it unchanged. If the receiver does not have any data to provide, it should return an empty NSArray object.


The input and output objects for actions are usually instances of NSArray. If the receiver encounters problems, it should return by indirection an NSError object that describes the error.

This method is intended to be overridden.

See Also

Controlling the action

- didFinishRunningWithError:

Sent by the receiver to itself when it has finished running asynchronously.

- finishRunningWithError:

Causes the action to stop running and return an error, which, in turn, causes the workflow to stop.

- reset

Resets the receiver to its initial state.

- runAsynchronouslyWithInput:

Causes Automator to wait for notification that the receiver has completed execution, which allows the receiver to perform an asynchronous operation.

- runWithInput:fromAction:error:

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

- stop

Stops the receiver from running.

- willFinishRunning

Invoked by Automator when the receiver has essentially completed its run phase.