AMShellScriptAction Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Automator.framework
Availability
Available in OS X v10.4 and later.
Companion guide
Declared in
AMShellScriptAction.h

Overview

Instances of the AMShellScriptAction class own Automator actions whose runtime behavior is driven by a shell script or by a Perl or Python script.

When you create a Shell Script Automator Action project in Xcode, the project template supplies an AMShellScriptAction instance as File’s Owner of the action bundle. This ready-made instance provides a default implementation of the AMActionrunWithInput:fromAction:error: method that uses the logic defined in the script. You can substitute your own subclass of AMShellScriptAction for File’s Owner if you need to.

Tasks

Handling the I/O Separator Character

Instance Methods

inputFieldSeparator

Returns the character that is used as the delimiter between items in the string passed in through standard input.

- (NSString *)inputFieldSeparator
Discussion

The Automator framework converts the output from the previous action (which is usually in the form of a list or array) into a single string in which the array elements are concatenated by the input field separator. By default this separator is the newline character (@”\n”). You could, for example, override this method to return a null character (@”\0”) to provide null-terminated strings for xargs -0.

Availability
  • Available in OS X v10.4 and later, Xcode 2.1 and later.
Declared In
AMShellScriptAction.h

outputFieldSeparator

Returns the character used as a delimiter in the string output of the receiver.

- (NSString *)outputFieldSeparator
Discussion

The Automator framework converts this string into an array (or list) whose elements are derived from the fields delimited by the separator character, and then passes the array (or list) to the next action in the workflow. The default value is the separator character returned by inputFieldSeparator. Override this method if you want a different delimiter for output.

Availability
  • Available in OS X v10.4 and later, Xcode 2.1 and later.
Declared In
AMShellScriptAction.h

remapLineEndings

Returns whether you want automatic remapping of carriage return (\r) to newline (\n) characters in the input string.

- (BOOL)remapLineEndings
Discussion

The default is NO. Override to return YES if you want the remapping to occur.

Availability
  • Available in OS X v10.4 and later, Xcode 2.1 and later.
Declared In
AMShellScriptAction.h