runWithInput:fromAction:error:
Requests the action to perform its task using the specified input from the specified action.
Declaration
- (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, orcom.apple.cocoa.data.Shell script actions: Accepts and provides types must inherit from
com.apple.cocoa.stringorcom.apple.cocoa.data.AppleScript actions: Accepts and provides types must inherit from
com.apple.applescript.object.
- anAction:
The action from which the
inputobject 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 Nsnumber whose integer value indicates an error code. See the header fileMacErrors.hin 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 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 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.