AMAppleScriptAction 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
AMAppleScriptAction.h

Overview

Instances of the AMAppleScriptAction class own Automator actions whose runtime behavior is driven by an AppleScript script. An AMAppleScriptAction object holds the compiled script as an instance of the OSAScript class. By default, the OSAScript object is instantiated from the script in the Xcode project file main.applescript.

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

Tasks

Accessing the Script

Instance Methods

script

Returns the OSAScript object representing the receiver’s script containing the on run command handler.

- (OSAScript *)script
Discussion

By default, this script is main.applescript, which is stored in the action bundle.

Availability
  • Available in OS X v10.4 and later.
Declared In
AMAppleScriptAction.h

setScript:

Set’s the receiver’s script to newScript.

- (void)setScript:(OSAScript *)newScript
Discussion

newScript must be an OSAScript object that could be instantiated from a script in the action bundle. The script must contain the on run command handler.

Availability
  • Available in OS X v10.4 and later.
Declared In
AMAppleScriptAction.h