Class

AMWorkflow

The AMWorkflow class lets you use an Automator workflow in your application. You can display a workflow with an instance of AMWorkflowView and control its operation with an instance of AMWorkflowController.

Declaration

@interface AMWorkflow : NSObject

Overview

A workflow consists of one or more actions (discrete tasks), which together can perform complex automation tasks. Your application can use workflows to package its own features and to take advantage of features provided by other applications. You create actions with Xcode, while you create workflows with the Automator application.

You can load and run a workflow with minimal overhead by using the AMWorkflow class method runWorkflowAtURL:withInput:error:. However, in situations where you need greater control, such as the ability to start and stop the workflow, you can use an instance of the AMWorkflowController class instead. In that case, you’ll have to create and initialize both a workflow and a workflow controller object.

In either case, the workflow is run in a separate process so that any actions it contains are executed in a separate memory space. That helps to insulate your application from crashes, memory leaks, or exceptions that might occur from running the actions in the workflow.

Topics

Running a specified workflow

+ runWorkflowAtURL:withInput:error:

Loads and runs the specified workflow file.

Creating and initializing a workflow

- initWithContentsOfURL:error:

Creates and initializes a workflow based on the contents of the specified file.

Saving changes to a workflow

- writeToURL:error:

Writes the workflow to the specified file.

Getting information about the workflow

actions

Returns an array of the workflow’s actions.

fileURL

Returns a URL that specifies the location of the workflow file.

- valueForVariableWithName:

Returns the value of the workflow variable with the specified name.

Working with the workflow’s input and output

input

Returns the input data that is passed to the first action in the workflow.

output

Returns the output data that is provided by the last action in the workflow.

Manipulating the workflow

- setValue:forVariableWithName:

Sets the value of the workflow variable with the specified name.

Manipulating the workflow’s actions

- addAction:

Adds the specified action at the end of the receiving workflow.

- insertAction:atIndex:

Inserts the specified action at the specified position of the receiving workflow.

- moveActionAtIndex:toIndex:

Moves the action from the specified start position to the specified end position in the receiving workflow.

- removeAction:

Removes the specified action from the receiver.

Initializers

Relationships

Inherits From

Conforms To