Instances of the AMBundleAction class manage Automator actions that are loadable bundles. Automator loads action bundles from standard locations in the file system: /System/Library/Automator, /Library/Automator, and ~/Library/Automator.


class AMBundleAction : AMAction


AMBundleAction objects have several important properties:

  • The Bundle object associated with the action’s physical bundle

  • The action’s view, which holds its user interface

  • A parameters dictionary that reflects the settings in the user interface

When you create a Cocoa Automator Action project in Xcode, the project template includes a custom subclass of AMBundleAction. (This custom class is given the name of the project.) The sole requirement for this custom class is to provide an implementation of run(withInput:), which is declared by the superclass AMAction.

Subclassing Notes

As noted in the Overview section, the Xcode project templates for Automator actions includes partially completed header and source files for a custom subclass of AMBundleAction. The name of this custom class is the name of the Xcode project. To complete the implementation of this subclass, you must override run(withInput:) (declared by AMAction).

Methods to Override

To subclass AMBundleAction, you must override the run(withInput:) to implement the task performed by the action. If you have added any instance variables, you must override the initWithDefinition:fromArchive: method and the write(to:) method of AMAction to work with them.


Initializing the action

func awakeFromBundle()

Sent to the receiver when all objects in its bundle have been unarchived.


Initializes and returns an allocated AMBundleAction object.

Setting and getting action properties

var bundle: Bundle

Returns the receiver’s bundle object.

var hasView: Bool

Returns whether the receiver has a view associated with it.

var view: NSView?

Returns the receiver’s view object.

var parameters: NSMutableDictionary?

Returns the receiver's parameters.


Inherits From