Documentation
¶
Overview ¶
Package automator provides Go bindings for the Automator framework.
Develop actions that the Automator app can load and run. View, edit, and run Automator workflows in your app.
The Automator framework supports the development of actions for the Automator app, as well as the ability to run a workflow in developer apps. An action is a bundle that, when loaded and run, performs a specific task, such as copying a file or cropping an image. Using Automator, users can construct and execute workflows consisting of a sequence of actions. Developers can also load and execute workflows in their apps. As a workflow executes, the output of one action is typically passed as the input to the next action. Automator loads action bundles from standard locations in the file system: `/System/Library/Automator`, `/Library/Automator`, and `~/Library/Automator`.
Actions ¶
- AMBundleAction: An object that represents an Automator action that’s a loadable bundle.
- AMShellScriptAction: An object that represents Automator actions whose runtime behavior is driven by a shell script or by a Perl or Python script.
- AMAction: An abstract class that defines the interface and general characteristics of Automator actions. (AMLogLevel)
Workflows ¶
- AMWorkflow: An object that lets you use an Automator workflow in your app.
- AMWorkflowController: An object that lets you manage an Automator workflow in your app. (AMWorkflowControllerDelegate)
- AMWorkflowView: An object that lets you view and edit Automator workflows in your app.
- AMWorkspace: A workspace for running an Automator workflow.
Errors ¶
- AMErrorCode: Automator error codes.
Key Types ¶
- AMAction - An abstract class that defines the interface and general characteristics of Automator actions.
- AMWorkflow - An object that lets you use an Automator workflow in your app.
- AMWorkflowController - An object that lets you manage an Automator workflow in your app.
- AMBundleAction - An object that represents an Automator action that’s a loadable bundle.
- AMShellScriptAction - An object that represents Automator actions whose runtime behavior is driven by a shell script or by a Perl or Python script.
- AMWorkflowView - An object that lets you view and edit Automator workflows in your app.
- AMWorkspace - A workspace for running an Automator workflow.
Code generated from Apple documentation. DO NOT EDIT.
Index ¶
- type AMAction
- func (a AMAction) Activated()
- func (a AMAction) Autorelease() AMAction
- func (a AMAction) Closed()
- func (a AMAction) FinishRunningWithError(error_ foundation.NSError)
- func (a AMAction) IgnoresInput() bool
- func (a AMAction) Init() AMAction
- func (a AMAction) InitWithContentsOfURLError(fileURL foundation.NSURL) (AMAction, error)
- func (a AMAction) InitWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMAction
- func (a AMAction) IsStopped() bool
- func (a AMAction) Name() string
- func (a AMAction) Opened()
- func (a AMAction) Output() objectivec.IObject
- func (a AMAction) ParametersUpdated()
- func (a AMAction) ProgressValue() float64
- func (a AMAction) Reset()
- func (a AMAction) RunAsynchronouslyWithInput(input objectivec.IObject)
- func (a AMAction) RunWithInputError(input objectivec.IObject) (objectivec.IObject, error)
- func (a AMAction) SelectedInputType() string
- func (a AMAction) SelectedOutputType() string
- func (a AMAction) SetOutput(value objectivec.IObject)
- func (a AMAction) SetProgressValue(value float64)
- func (a AMAction) SetSelectedInputType(value string)
- func (a AMAction) SetSelectedOutputType(value string)
- func (a AMAction) Stop()
- func (a AMAction) UpdateParameters()
- func (a AMAction) WillFinishRunning()
- func (a AMAction) WriteToDictionary(dictionary foundation.INSDictionary)
- type AMActionClass
- type AMBundleAction
- func AMBundleActionFromID(id objc.ID) AMBundleAction
- func NewAMBundleAction() AMBundleAction
- func NewAMBundleActionWithCoder(coder foundation.INSCoder) AMBundleAction
- func NewAMBundleActionWithContentsOfURLError(fileURL foundation.NSURL) (AMBundleAction, error)
- func NewAMBundleActionWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMBundleAction
- func (a AMBundleAction) Autorelease() AMBundleAction
- func (a AMBundleAction) AwakeFromBundle()
- func (a AMBundleAction) Bundle() foundation.Bundle
- func (a AMBundleAction) HasView() bool
- func (a AMBundleAction) Init() AMBundleAction
- func (a AMBundleAction) Parameters() foundation.INSDictionary
- func (a AMBundleAction) SetParameters(value foundation.INSDictionary)
- func (a AMBundleAction) View() appkit.NSView
- type AMBundleActionClass
- type AMErrorCode
- type AMLogLevel
- type AMShellScriptAction
- func AMShellScriptActionFromID(id objc.ID) AMShellScriptAction
- func NewAMShellScriptAction() AMShellScriptAction
- func NewAMShellScriptActionWithCoder(coder foundation.INSCoder) AMShellScriptAction
- func NewAMShellScriptActionWithContentsOfURLError(fileURL foundation.NSURL) (AMShellScriptAction, error)
- func NewAMShellScriptActionWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMShellScriptAction
- type AMShellScriptActionClass
- type AMWorkflow
- func (a AMWorkflow) Actions() []AMAction
- func (a AMWorkflow) AddAction(action IAMAction)
- func (a AMWorkflow) Autorelease() AMWorkflow
- func (a AMWorkflow) FileURL() foundation.NSURL
- func (a AMWorkflow) Init() AMWorkflow
- func (a AMWorkflow) InitWithContentsOfURLError(fileURL foundation.NSURL) (AMWorkflow, error)
- func (a AMWorkflow) Input() objectivec.IObject
- func (a AMWorkflow) InsertActionAtIndex(action IAMAction, index uint)
- func (a AMWorkflow) MoveActionAtIndexToIndex(startIndex uint, endIndex uint)
- func (a AMWorkflow) Output() objectivec.IObject
- func (a AMWorkflow) RemoveAction(action IAMAction)
- func (a AMWorkflow) SetInput(value objectivec.IObject)
- func (a AMWorkflow) SetValueForVariableWithName(value objectivec.IObject, variableName string) bool
- func (a AMWorkflow) ValueForVariableWithName(variableName string) objectivec.IObject
- func (a AMWorkflow) WriteToURLError(fileURL foundation.NSURL) (bool, error)
- type AMWorkflowClass
- type AMWorkflowController
- func (a AMWorkflowController) Autorelease() AMWorkflowController
- func (a AMWorkflowController) CanRun() bool
- func (a AMWorkflowController) Delegate() AMWorkflowControllerDelegate
- func (a AMWorkflowController) Init() AMWorkflowController
- func (a AMWorkflowController) IsPaused() bool
- func (a AMWorkflowController) IsRunning() bool
- func (a AMWorkflowController) Pause(sender objectivec.IObject)
- func (a AMWorkflowController) Reset(sender objectivec.IObject)
- func (a AMWorkflowController) Run(sender objectivec.IObject)
- func (a AMWorkflowController) SetDelegate(value AMWorkflowControllerDelegate)
- func (a AMWorkflowController) SetWorkflow(value IAMWorkflow)
- func (a AMWorkflowController) SetWorkflowView(value IAMWorkflowView)
- func (a AMWorkflowController) Step(sender objectivec.IObject)
- func (a AMWorkflowController) Stop(sender objectivec.IObject)
- func (a AMWorkflowController) Workflow() IAMWorkflow
- func (a AMWorkflowController) WorkflowView() IAMWorkflowView
- type AMWorkflowControllerClass
- type AMWorkflowControllerDelegate
- type AMWorkflowControllerDelegateConfig
- type AMWorkflowControllerDelegateObject
- func (o AMWorkflowControllerDelegateObject) BaseObject() objectivec.Object
- func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidError(controller IAMWorkflowController, error_ foundation.NSError)
- func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidRun(controller IAMWorkflowController)
- func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidRunAction(controller IAMWorkflowController, action IAMAction)
- func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidStop(controller IAMWorkflowController)
- func (o AMWorkflowControllerDelegateObject) WorkflowControllerWillRun(controller IAMWorkflowController)
- func (o AMWorkflowControllerDelegateObject) WorkflowControllerWillRunAction(controller IAMWorkflowController, action IAMAction)
- func (o AMWorkflowControllerDelegateObject) WorkflowControllerWillStop(controller IAMWorkflowController)
- type AMWorkflowView
- func (a AMWorkflowView) Autorelease() AMWorkflowView
- func (a AMWorkflowView) Init() AMWorkflowView
- func (a AMWorkflowView) IsEditable() bool
- func (a AMWorkflowView) SetEditable(value bool)
- func (a AMWorkflowView) SetWorkflowController(value IAMWorkflowController)
- func (a AMWorkflowView) WorkflowController() IAMWorkflowController
- type AMWorkflowViewClass
- type AMWorkspace
- type AMWorkspaceClass
- type IAMAction
- type IAMBundleAction
- type IAMShellScriptAction
- type IAMWorkflow
- type IAMWorkflowController
- type IAMWorkflowView
- type IAMWorkspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AMAction ¶
type AMAction struct {
objectivec.Object
}
An abstract class that defines the interface and general characteristics of Automator actions.
Overview ¶
Automator is an Apple app that allows users to construct and execute workflows consisting of a sequence of discrete modules called actions. An action performs a specific task, such as copying a file or cropping an image, and passes its output to Automator to give to the next action in the workflow. Actions are currently implemented as loadable bundles owned by objects of the AMBundleAction class, a subclass of AMAction.
The critically important method declared by AMAction is AMAction.RunWithInputError. When Automator executes a workflow, it sends this message to each action object in the workflow (in workflow sequence), in most cases passing in the output of the previous action as input. The action object performs its task in this method and ends by returning an output object for the next action in the workflow.
Subclassing AMAction is not recommended. For most situations requiring an enhancement to the Automator framework, it is sufficient to subclass AMBundleAction.
Initializing and Encoding ¶
- AMAction.InitWithDefinitionFromArchive: Initializes the action with the specified definition.
- AMAction.InitWithContentsOfURLError: Loads an Automator action from a file URL.
- AMAction.WriteToDictionary: Examines the parameters and other configuration information specified in the passed dictionary and adds its own information to it if appropriate.
Controlling the Action ¶
- AMAction.RunWithInputError: Requests the action to perform its task using the specified input.
- AMAction.RunAsynchronouslyWithInput: Causes Automator to wait for notification that the action has completed execution, which allows the action to perform an asynchronous operation.
- AMAction.FinishRunningWithError: Causes the action to stop running and return an error, which, in turn, causes the workflow to stop.
- AMAction.WillFinishRunning: Provides an opportunity for an action to perform cleanup operations, such as closing windows and deallocating memory.
- AMAction.Stop: Stops the action from running.
- AMAction.Reset: Resets the action to its initial state.
Initializing and Synchronizing the Action User Interface ¶
- AMAction.Activated: Allows the action to synchronize its information with settings in another app.
- AMAction.Opened: Allows the action to initialize its user interface.
Updating Action Parameters ¶
- AMAction.ParametersUpdated: Requests the action to update its user interface from its stored parameters, which have changed.
- AMAction.UpdateParameters: Requests the action to update its stored set of parameters from the settings in the action’s user interface.
Getting Action Information ¶
- AMAction.Name: The name of the action.
- AMAction.ProgressValue: A float value between 0 and 1, which indicates how far along the action is while processing.
- AMAction.SetProgressValue
- AMAction.IgnoresInput: A Boolean value that indicates whether the action acts upon its input or the input is ignored.
- AMAction.Output: The action’s output.
- AMAction.SetOutput
- AMAction.SelectedInputType: The type of input, in UTI format, of the input received by the action.
- AMAction.SetSelectedInputType
- AMAction.SelectedOutputType: The type of output, in UTI format, of the output to be produced by the action.
- AMAction.SetSelectedOutputType
- AMAction.IsStopped: A Boolean value that indicates whether the user clicked the stop button on the parent workflow.
Performing Cleanup Operations ¶
- AMAction.Closed: Invoked by Automator when the receiving action is removed from a workflow, allowing it to perform cleanup operations.
See: https://developer.apple.com/documentation/Automator/AMAction
func AMActionFromID ¶
AMActionFromID constructs a AMAction from an objc.ID.
An abstract class that defines the interface and general characteristics of Automator actions.
func NewAMActionWithContentsOfURLError ¶
func NewAMActionWithContentsOfURLError(fileURL foundation.NSURL) (AMAction, error)
Loads an Automator action from a file URL.
fileURL: URL that specifies the location of an action file.
Return Value ¶
The initialized action.
Discussion ¶
This method is typically invoked by app that use the AMWorkflow class to embed Automator workflows. It is used to allow creation of actions for a workflow.
See: https://developer.apple.com/documentation/Automator/AMAction/init(contentsOf:)
func NewAMActionWithDefinitionFromArchive ¶
func NewAMActionWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMAction
Initializes the action with the specified definition.
dict: A dictionary that describes the action, including any custom definition properties.
archived: If the action is being unarchived, true; otherwise, false.
Return Value ¶
The initialized action.
Discussion ¶
This is the primary initializer for all Automator classes. The Automator app sends this message to instances of AMAction both when it loads actions bundles and when it unarchives them.
The AMAction object being instantiated should perform whatever initializations are necessary after invoking `super`’s implementation of this method. It can then examine the values in `dict`, particularly if the action had been archived with custom definition properties.
See: https://developer.apple.com/documentation/Automator/AMAction/init(definition:fromArchive:)
func (AMAction) Activated ¶
func (a AMAction) Activated()
Allows the action to synchronize its information with settings in another app.
Discussion ¶
The system invokes this method when the window of the Automator workflow to which the action belongs becomes the main window.
Be sure to invoke the superclass implementation of this method as the last thing in your implementation.
See: https://developer.apple.com/documentation/Automator/AMAction/activated()
func (AMAction) Autorelease ¶
Autorelease adds the receiver to the current autorelease pool.
func (AMAction) Closed ¶
func (a AMAction) Closed()
Invoked by Automator when the receiving action is removed from a workflow, allowing it to perform cleanup operations.
Discussion ¶
This method is intended to be overridden, so that your action can perform its specific cleanup operations.
See: https://developer.apple.com/documentation/Automator/AMAction/closed()
func (AMAction) FinishRunningWithError ¶
func (a AMAction) FinishRunningWithError(error_ foundation.NSError)
Causes the action to stop running and return an error, which, in turn, causes the workflow to stop.
error: The error to be returned to Automator.
Discussion ¶
Call this method on any action that overrides AMAction.RunAsynchronouslyWithInput in order to make asynchronous calls. When AMAction.FinishRunningWithError is invoked, it immediately calls AMAction.WillFinishRunning.
See: https://developer.apple.com/documentation/Automator/AMAction/finishRunningWithError(_:)
func (AMAction) IgnoresInput ¶
A Boolean value that indicates whether the action acts upon its input or the input is ignored.
Discussion ¶
true if the action acts upon its input, otherwise false.
Many actions act upon their input, but an action may merely pass on its input or, rarely, ignore it.
See: https://developer.apple.com/documentation/Automator/AMAction/ignoresInput
func (AMAction) InitWithContentsOfURLError ¶
func (a AMAction) InitWithContentsOfURLError(fileURL foundation.NSURL) (AMAction, error)
Loads an Automator action from a file URL.
fileURL: URL that specifies the location of an action file.
Return Value ¶
The initialized action.
Discussion ¶
This method is typically invoked by app that use the AMWorkflow class to embed Automator workflows. It is used to allow creation of actions for a workflow.
See: https://developer.apple.com/documentation/Automator/AMAction/init(contentsOf:)
func (AMAction) InitWithDefinitionFromArchive ¶
func (a AMAction) InitWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMAction
Initializes the action with the specified definition.
dict: A dictionary that describes the action, including any custom definition properties.
archived: If the action is being unarchived, true; otherwise, false.
Return Value ¶
The initialized action.
Discussion ¶
This is the primary initializer for all Automator classes. The Automator app sends this message to instances of AMAction both when it loads actions bundles and when it unarchives them.
The AMAction object being instantiated should perform whatever initializations are necessary after invoking `super`’s implementation of this method. It can then examine the values in `dict`, particularly if the action had been archived with custom definition properties.
See: https://developer.apple.com/documentation/Automator/AMAction/init(definition:fromArchive:)
func (AMAction) IsStopped ¶
A Boolean value that indicates whether the user clicked the stop button on the parent workflow.
Discussion ¶
This value is true if the user clicked the stop button, or false if the workflow is still running. This property should be referenced during lengthy action processes, such as a loop, in order to determine whether to exit the operation and stop the action.
See: https://developer.apple.com/documentation/Automator/AMAction/isStopped
func (AMAction) Name ¶
The name of the action.
See: https://developer.apple.com/documentation/Automator/AMAction/name
func (AMAction) Opened ¶
func (a AMAction) Opened()
Allows the action to initialize its user interface.
Discussion ¶
The system invokes this method when the action is first added to a workflow.
You should perform all initializations of an action’s user interface in this method and not in `awakeFromNib`. Be sure to invoke the superclass implementation of this method as the final step of your implementation.
See: https://developer.apple.com/documentation/Automator/AMAction/opened()
func (AMAction) Output ¶
func (a AMAction) Output() objectivec.IObject
The action’s output.
Return Value ¶
The receiving action’s output, or `nil` if called before the action is run.
Discussion ¶
`nil` if called before the action is run.
This method is used in conjunction with the AMWorkflow class, which allows access to the actions in a workflow. Within a workflow, for example, you might iteratively inspect the output of each action. Or, on completion of a workflow, you might examine the output of the last action, to determine the output of the workflow.
This parameter can also be used when running an action asynchronously. Call `setOutput` to specify the output the action produces.
See: https://developer.apple.com/documentation/Automator/AMAction/output
func (AMAction) ParametersUpdated ¶
func (a AMAction) ParametersUpdated()
Requests the action to update its user interface from its stored parameters, which have changed.
See: https://developer.apple.com/documentation/Automator/AMAction/parametersUpdated()
func (AMAction) ProgressValue ¶
A float value between 0 and 1, which indicates how far along the action is while processing.
Discussion ¶
Setting this value causes Automator’s action progress indicator (displayed as a workflow runs) to update in order to provide the user with an indication of progress.
See: https://developer.apple.com/documentation/Automator/AMAction/progressValue
func (AMAction) Reset ¶
func (a AMAction) Reset()
Resets the action to its initial state.
Discussion ¶
Resetting causes the action to release its output generated from the current execution of the workflow.
See: https://developer.apple.com/documentation/Automator/AMAction/reset()
func (AMAction) RunAsynchronouslyWithInput ¶
func (a AMAction) RunAsynchronouslyWithInput(input objectivec.IObject)
Causes Automator to wait for notification that the action has completed execution, which allows the action to perform an asynchronous operation.
input: The input for the action. Should contain one or more objects compatible with one of the types specified in the action’s AMAction.SelectedInputType property.
Discussion ¶
Override this method in actions that need to make asynchronous calls. After AMAction.RunAsynchronouslyWithInput is invoked, Automator doesn’t continue until the action invokes AMAction.FinishRunningWithError. In your override of this method, you can make an asynchronous call, wait to be notified of its completion, then invoke AMAction.FinishRunningWithError to signal to Automator that the action has completed.
For actions that don’t need to make asynchronous calls, use runWithInput:fromAction:error: instead.
See: https://developer.apple.com/documentation/Automator/AMAction/runAsynchronously(withInput:)
func (AMAction) RunWithInputError ¶
func (a AMAction) RunWithInputError(input objectivec.IObject) (objectivec.IObject, error)
Requests the action to perform its task using the specified input.
input: The input for the receiving action. Should contain one or more objects compatible with one of the types specified in the action’s AMAction.SelectedInputType property.
Return Value ¶
An NSArray object that contains 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. If the action doesn’t have any data to provide, it should return an empty NSArray object.
Discussion ¶
This method is intended to be overridden.
The input and output objects for actions are usually instances of NSArray. If the action encounters problems, it should return by indirection an NSError object that describes the error.
See: https://developer.apple.com/documentation/Automator/AMAction/run(withInput:)
func (AMAction) SelectedInputType ¶
The type of input, in UTI format, of the input received by the action.
Discussion ¶
Getting this value provides the type of input the action is configured to accept. For example, your action may have the ability to accept files and folders, or documents, depending on how it’s configured and what action precedes it in the workflow.
The input types the action supports are specified in the action’s `Info.Plist()` file. By default, this property defaults to first input type in the `Info.Plist()` file.
Through its interface, the action can could be configured to allow the user to specify the type of input the action should accept. For example, a Contacts action may allow the user to configure whether the action accepts people or groups. In cases like this, set this property value to explicitly indicate the input type the action accepts. Setting this value to accurately reflect the appropriate type of input helps Automator determine whether the input the action receives is compatible, or can be made compatible, with the action.
See: https://developer.apple.com/documentation/Automator/AMAction/selectedInputType
func (AMAction) SelectedOutputType ¶
The type of output, in UTI format, of the output to be produced by the action.
Discussion ¶
Getting this value provides the type of output the action is configured to produce. For example, your action may have the ability to output files and folders, or documents, depending on how it’s configured or what it encounters while processing.
The output types the action supports are specified in the action’s `Info.Plist()` file. By default, this property defaults to the first output type in the `Info.Plist()` file.
Set this value to explicitly specify the output type the action produces. Setting this value to accurately reflect the appropriate output helps Automator determine whether the output is compatible, or can be made compatible, with the next action in the workflow.
See: https://developer.apple.com/documentation/Automator/AMAction/selectedOutputType
func (AMAction) SetOutput ¶
func (a AMAction) SetOutput(value objectivec.IObject)
func (AMAction) SetProgressValue ¶
func (AMAction) SetSelectedInputType ¶
func (AMAction) SetSelectedOutputType ¶
func (AMAction) Stop ¶
func (a AMAction) Stop()
Stops the action from running.
Discussion ¶
The output acquired by the action during execution of the current workflow is still accessible to Automator.
See: https://developer.apple.com/documentation/Automator/AMAction/stop()
func (AMAction) UpdateParameters ¶
func (a AMAction) UpdateParameters()
Requests the action to update its stored set of parameters from the settings in the action’s user interface.
Discussion ¶
This message sends just before an action is saved, copied, or run. Preferably, an action’s settings should not solely reside in the controls of its view, but if they do, the action can fetch and save them in this method.
See: https://developer.apple.com/documentation/Automator/AMAction/updateParameters()
func (AMAction) WillFinishRunning ¶
func (a AMAction) WillFinishRunning()
Provides an opportunity for an action to perform cleanup operations, such as closing windows and deallocating memory.
Discussion ¶
Overridde this method in actions that need to make asynchronous calls. Automator invokes this method when the action is about to complete its run phase.
See: https://developer.apple.com/documentation/Automator/AMAction/willFinishRunning()
func (AMAction) WriteToDictionary ¶
func (a AMAction) WriteToDictionary(dictionary foundation.INSDictionary)
Examines the parameters and other configuration information specified in the passed dictionary and adds its own information to it if appropriate.
dictionary: A dictionary that contains parameter and other configuration information about the action.
Discussion ¶
Automator sends this message to an action object prior to archiving it. In its implementation of this method, the action object should first invoke the superclass implementation.
See: https://developer.apple.com/documentation/Automator/AMAction/write(to:)
type AMActionClass ¶
type AMActionClass struct {
// contains filtered or unexported fields
}
func GetAMActionClass ¶
func GetAMActionClass() AMActionClass
GetAMActionClass returns the class object for AMAction.
func (AMActionClass) Alloc ¶
func (ac AMActionClass) Alloc() AMAction
Alloc allocates memory for a new instance of the class.
func (AMActionClass) Class ¶
func (ac AMActionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type AMBundleAction ¶
type AMBundleAction struct {
AMAction
}
An object that represents an Automator action that’s a loadable bundle.
Overview ¶
Automator loads action bundles from standard locations in the file system: `/System/Library/Automator`, `/Library/Automator`, and `~/Library/Automator`.
AMBundleAction objects have several important properties:
- The AMBundleAction.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 uses the name of the project.
You must provide an implementation of AMAction.RunWithInputError, which is declared by the superclass AMAction. If you add any instance variables, you must override the [AMShellScriptAction.InitWithDefinitionFromArchive] method and the AMAction.WriteToDictionary method of AMAction to work with them.
Initializing the Action ¶
- AMBundleAction.AwakeFromBundle: Allows the action object to perform setup tasks requiring the presence of all bundle objects.
Managing Action Properties ¶
- AMBundleAction.Bundle: The action’s bundle object.
- AMBundleAction.HasView: A Boolean value that indicates whether the action has a view associated with it.
- AMBundleAction.View: The action’s view object.
- AMBundleAction.Parameters: The action’s parameters.
- AMBundleAction.SetParameters
See: https://developer.apple.com/documentation/Automator/AMBundleAction
func AMBundleActionFromID ¶
func AMBundleActionFromID(id objc.ID) AMBundleAction
AMBundleActionFromID constructs a AMBundleAction from an objc.ID.
An object that represents an Automator action that’s a loadable bundle.
func NewAMBundleAction ¶
func NewAMBundleAction() AMBundleAction
NewAMBundleAction creates a new AMBundleAction instance.
func NewAMBundleActionWithCoder ¶
func NewAMBundleActionWithCoder(coder foundation.INSCoder) AMBundleAction
See: https://developer.apple.com/documentation/Automator/AMBundleAction/init(coder:)
func NewAMBundleActionWithContentsOfURLError ¶
func NewAMBundleActionWithContentsOfURLError(fileURL foundation.NSURL) (AMBundleAction, error)
Loads an Automator action from a file URL.
fileURL: URL that specifies the location of an action file.
Return Value ¶
The initialized action.
Discussion ¶
This method is typically invoked by app that use the AMWorkflow class to embed Automator workflows. It is used to allow creation of actions for a workflow.
See: https://developer.apple.com/documentation/Automator/AMAction/init(contentsOf:)
func NewAMBundleActionWithDefinitionFromArchive ¶
func NewAMBundleActionWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMBundleAction
Initializes the action with the specified definition.
dict: A dictionary that describes the action, including any custom definition properties.
archived: If the action is being unarchived, true; otherwise, false.
Return Value ¶
The initialized action.
Discussion ¶
This is the primary initializer for all Automator classes. The Automator app sends this message to instances of AMAction both when it loads actions bundles and when it unarchives them.
The AMAction object being instantiated should perform whatever initializations are necessary after invoking `super`’s implementation of this method. It can then examine the values in `dict`, particularly if the action had been archived with custom definition properties.
See: https://developer.apple.com/documentation/Automator/AMAction/init(definition:fromArchive:)
func (AMBundleAction) Autorelease ¶
func (a AMBundleAction) Autorelease() AMBundleAction
Autorelease adds the receiver to the current autorelease pool.
func (AMBundleAction) AwakeFromBundle ¶
func (a AMBundleAction) AwakeFromBundle()
Allows the action object to perform setup tasks requiring the presence of all bundle objects.
Discussion ¶
The system sends this message to the action object when all objects in its bundle have been unarchived. Use this method to perform setup tasks such as adding the action object as an observer of notifications, dynamically establishing bindings, and dynamically setting targets and actions.
See: https://developer.apple.com/documentation/Automator/AMBundleAction/awakeFromBundle()
func (AMBundleAction) Bundle ¶
func (a AMBundleAction) Bundle() foundation.Bundle
The action’s bundle object.
See: https://developer.apple.com/documentation/Automator/AMBundleAction/bundle
func (AMBundleAction) HasView ¶
func (a AMBundleAction) HasView() bool
A Boolean value that indicates whether the action has a view associated with it.
See: https://developer.apple.com/documentation/Automator/AMBundleAction/hasView
func (AMBundleAction) Init ¶
func (a AMBundleAction) Init() AMBundleAction
Init initializes the instance.
func (AMBundleAction) Parameters ¶
func (a AMBundleAction) Parameters() foundation.INSDictionary
The action’s parameters.
Discussion ¶
The parameters of an action reflect the choices made and values entered in the action’s user interface. Keys in the parameters dictionary identify specific user-interface objects. If an action uses the Cocoa bindings mechanism, the parameters of an AMBundleAction object are automatically set.
See: https://developer.apple.com/documentation/Automator/AMBundleAction/parameters
func (AMBundleAction) SetParameters ¶
func (a AMBundleAction) SetParameters(value foundation.INSDictionary)
func (AMBundleAction) View ¶
func (a AMBundleAction) View() appkit.NSView
The action’s view object.
See: https://developer.apple.com/documentation/Automator/AMBundleAction/view
type AMBundleActionClass ¶
type AMBundleActionClass struct {
// contains filtered or unexported fields
}
func GetAMBundleActionClass ¶
func GetAMBundleActionClass() AMBundleActionClass
GetAMBundleActionClass returns the class object for AMBundleAction.
func (AMBundleActionClass) Alloc ¶
func (ac AMBundleActionClass) Alloc() AMBundleAction
Alloc allocates memory for a new instance of the class.
func (AMBundleActionClass) Class ¶
func (ac AMBundleActionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type AMErrorCode ¶
type AMErrorCode int
See: https://developer.apple.com/documentation/Automator/AMError/Code
const ( // AMActionApplicationResourceError: An error that indicates an app required by the action is not found. AMActionApplicationResourceError AMErrorCode = -206 // AMActionApplicationVersionResourceError: An error that indicates an app required by the action is the wrong version. AMActionApplicationVersionResourceError AMErrorCode = -207 // AMActionArchitectureMismatchError: An error that indicates the action’s binary is not compatible with the current processor. AMActionArchitectureMismatchError AMErrorCode = -202 // AMActionExceptionError: An error that indicates an action encounters an exception while running. AMActionExceptionError AMErrorCode = -213 // AMActionExecutionError: An error that indicates an action encounters an error while running (reason unknown). AMActionExecutionError AMErrorCode = -212 // AMActionFailedGatekeeperError: An error that indicates the action doesn’t meet the Gatekeeper security policy. AMActionFailedGatekeeperError AMErrorCode = -217 // AMActionFileResourceError: An error that indicates a file required by the action is not found. AMActionFileResourceError AMErrorCode = -208 // AMActionInitializationError: An error that indicates Automator is unable to initialize an action (reason unknown). AMActionInitializationError AMErrorCode = -211 // AMActionInsufficientDataError: An error that indicates the action requires input data to run, but none was supplied. AMActionInsufficientDataError AMErrorCode = -215 // AMActionIsDeprecatedError: An error that indicates the action has been deprecated. AMActionIsDeprecatedError AMErrorCode = -216 // AMActionLicenseResourceError: An error that indicates a license required by the action was not found. AMActionLicenseResourceError AMErrorCode = -209 // AMActionLinkError: An error that indicates the action’s executable failed to load due to linking issues. AMActionLinkError AMErrorCode = -205 // AMActionLoadError: An error that indicates the action’s executable failed to load. AMActionLoadError AMErrorCode = -204 // AMActionMalwareError: An error that indicates the action has been identified as malware by XProtect. AMActionMalwareError AMErrorCode = -221 // AMActionNotLoadableError: An error that indicates the action’s executable is of a type that is not loadable in the current process. AMActionNotLoadableError AMErrorCode = -201 // AMActionPropertyListInvalidError: An error that indicates the property list for an action is invalid. AMActionPropertyListInvalidError AMErrorCode = -214 // AMActionQuarantineError: An error that indicates action has been quarantined by XProtect, the antimalware system on the Mac. AMActionQuarantineError AMErrorCode = -219 // AMActionRequiredActionResourceError: An error that indicates an action required by the action is not loaded. AMActionRequiredActionResourceError AMErrorCode = -210 // AMActionRuntimeMismatchError: An error that indicates an attempt was made to load an action that is not compiled in a way that is compatible with the current app. AMActionRuntimeMismatchError AMErrorCode = -203 // AMActionSignatureCorruptError: An error that indicates developer signature for this action is corrupted. AMActionSignatureCorruptError AMErrorCode = -218 // AMActionThirdPartyActionsNotAllowedError: An error that indicates the action is a third party action, and loading it has not been allowed by the user. AMActionThirdPartyActionsNotAllowedError AMErrorCode = -222 // AMActionXPCError: An error that indicates the remote process running the action has crashed. AMActionXPCError AMErrorCode = -223 // AMActionXProtectError: An error that indicates XProtect is unable to successfully analyze the action. AMActionXProtectError AMErrorCode = -220 // AMConversionFailedError: An error that occurs when, for example, the converter encounters an error converting data from one type to another. AMConversionFailedError AMErrorCode = -302 // AMConversionNoDataError: An error that occurs when the converter determines that the conversion, though possible, would produce a nil result. AMConversionNoDataError AMErrorCode = -301 // AMConversionNotPossibleError: An error that occurs when the converter determines that it is unable to convert from one data type to another. AMConversionNotPossibleError AMErrorCode = -300 // AMNoSuchActionError: An error that indicates the action could not be located on the system. AMNoSuchActionError AMErrorCode = -200 // AMUserCanceledError: An error that indicates the user cancelled. AMUserCanceledError AMErrorCode = -128 // AMWorkflowActionsNotLoadedError: An error that indicates one of the actions of the workflow couldn’t be loaded. AMWorkflowActionsNotLoadedError AMErrorCode = -113 // AMWorkflowNewerActionVersionError: An error that indicates an action in a workflow is newer than the installed action. AMWorkflowNewerActionVersionError AMErrorCode = -111 // AMWorkflowNewerVersionError: An error that indicates an attempt to open a workflow document that was saved with a newer version of Automator. AMWorkflowNewerVersionError AMErrorCode = -100 // AMWorkflowNoEnabledActionsError: An error that indicates there are no enabled actions in the workflow. AMWorkflowNoEnabledActionsError AMErrorCode = -114 // AMWorkflowOlderActionVersionError: An error that indicates an action in a workflow is older than the installed action. AMWorkflowOlderActionVersionError AMErrorCode = -112 // AMWorkflowPropertyListInvalidError: An error that indicates an attempt to open a workflow document whose property list couldn’t be read. AMWorkflowPropertyListInvalidError AMErrorCode = -101 )
func (AMErrorCode) String ¶
func (e AMErrorCode) String() string
type AMLogLevel ¶
type AMLogLevel uint
See: https://developer.apple.com/documentation/Automator/AMLogLevel
const ( // AMLogLevelDebug: The debug log level. AMLogLevelDebug AMLogLevel = 0 // AMLogLevelError: The error log level. AMLogLevelError AMLogLevel = 3 // AMLogLevelInfo: The informational log level. AMLogLevelInfo AMLogLevel = 1 // AMLogLevelWarn: The warning log level. AMLogLevelWarn AMLogLevel = 2 )
func (AMLogLevel) String ¶
func (e AMLogLevel) String() string
type AMShellScriptAction ¶
type AMShellScriptAction struct {
AMBundleAction
}
An object that represents Automator actions whose runtime behavior is driven by a shell script or by a Perl or Python script.
Overview ¶
When you create a Shell Script Automator Action project in Xcode, the project template supplies an AMShellScriptAction instance as the Principal Class of the action bundle. This ready-made instance provides a default implementation of the AMAction AMAction.RunWithInputError method that uses the logic defined in the script. You can substitute your own subclass of AMShellScriptAction for Principal Class if you need to.
Handling the I/O Separator Character ¶
- AMShellScriptAction.InputFieldSeparator: A string to use as the delimiter between items in the string passed to the action through standard input.
- AMShellScriptAction.OutputFieldSeparator: A string to use as a delimiter in the string output by the action.
- AMShellScriptAction.RemapLineEndings: A Boolean value that indicates whether you want automatic remapping of carriage return (`\r`) to newline (`\n`) characters in the input string.
See: https://developer.apple.com/documentation/Automator/AMShellScriptAction
func AMShellScriptActionFromID ¶
func AMShellScriptActionFromID(id objc.ID) AMShellScriptAction
AMShellScriptActionFromID constructs a AMShellScriptAction from an objc.ID.
An object that represents Automator actions whose runtime behavior is driven by a shell script or by a Perl or Python script.
func NewAMShellScriptAction ¶
func NewAMShellScriptAction() AMShellScriptAction
NewAMShellScriptAction creates a new AMShellScriptAction instance.
func NewAMShellScriptActionWithCoder ¶
func NewAMShellScriptActionWithCoder(coder foundation.INSCoder) AMShellScriptAction
See: https://developer.apple.com/documentation/Automator/AMBundleAction/init(coder:)
func NewAMShellScriptActionWithContentsOfURLError ¶
func NewAMShellScriptActionWithContentsOfURLError(fileURL foundation.NSURL) (AMShellScriptAction, error)
Loads an Automator action from a file URL.
fileURL: URL that specifies the location of an action file.
Return Value ¶
The initialized action.
Discussion ¶
This method is typically invoked by app that use the AMWorkflow class to embed Automator workflows. It is used to allow creation of actions for a workflow.
See: https://developer.apple.com/documentation/Automator/AMAction/init(contentsOf:)
func NewAMShellScriptActionWithDefinitionFromArchive ¶
func NewAMShellScriptActionWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMShellScriptAction
Initializes the action with the specified definition.
dict: A dictionary that describes the action, including any custom definition properties.
archived: If the action is being unarchived, true; otherwise, false.
Return Value ¶
The initialized action.
Discussion ¶
This is the primary initializer for all Automator classes. The Automator app sends this message to instances of AMAction both when it loads actions bundles and when it unarchives them.
The AMAction object being instantiated should perform whatever initializations are necessary after invoking `super`’s implementation of this method. It can then examine the values in `dict`, particularly if the action had been archived with custom definition properties.
See: https://developer.apple.com/documentation/Automator/AMAction/init(definition:fromArchive:)
func (AMShellScriptAction) Autorelease ¶
func (a AMShellScriptAction) Autorelease() AMShellScriptAction
Autorelease adds the receiver to the current autorelease pool.
func (AMShellScriptAction) Init ¶
func (a AMShellScriptAction) Init() AMShellScriptAction
Init initializes the instance.
func (AMShellScriptAction) InputFieldSeparator ¶
func (a AMShellScriptAction) InputFieldSeparator() string
A string to use as the delimiter between items in the string passed to the action through standard input.
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 can override this method to, for example, return a null character (`\0`) to provide null-terminated strings for `xargs -0`.
See: https://developer.apple.com/documentation/Automator/AMShellScriptAction/inputFieldSeparator
func (AMShellScriptAction) OutputFieldSeparator ¶
func (a AMShellScriptAction) OutputFieldSeparator() string
A string to use as a delimiter in the string output by the action.
Discussion ¶
Upon completion, the Automator framework converts an output string provided by the action into an array (or list), to be passed to the next action in the workflow for further processing. The elements in this array are derived from fields delimited by the output field separator. The default value is the separator character returned by AMShellScriptAction.InputFieldSeparator. Override this method if you want a different delimiter for output.
See: https://developer.apple.com/documentation/Automator/AMShellScriptAction/outputFieldSeparator
func (AMShellScriptAction) RemapLineEndings ¶
func (a AMShellScriptAction) RemapLineEndings() bool
A Boolean value that indicates whether you want automatic remapping of carriage return (`\r`) to newline (`\n`) characters in the input string.
Discussion ¶
The default is false. Override to return true if you want the remapping to occur.
See: https://developer.apple.com/documentation/Automator/AMShellScriptAction/remapLineEndings
type AMShellScriptActionClass ¶
type AMShellScriptActionClass struct {
// contains filtered or unexported fields
}
func GetAMShellScriptActionClass ¶
func GetAMShellScriptActionClass() AMShellScriptActionClass
GetAMShellScriptActionClass returns the class object for AMShellScriptAction.
func (AMShellScriptActionClass) Alloc ¶
func (ac AMShellScriptActionClass) Alloc() AMShellScriptAction
Alloc allocates memory for a new instance of the class.
func (AMShellScriptActionClass) Class ¶
func (ac AMShellScriptActionClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type AMWorkflow ¶
type AMWorkflow struct {
objectivec.Object
}
An object that lets you use an Automator workflow in your app.
Overview ¶
A workflow consists of one or more actions, discrete tasks which together can perform complex automation tasks. Your app can use workflows to package its own features and to take advantage of features provided by other apps. You create actions with Xcode, while you create workflows with the Automator app.
You can load and run a workflow with minimal overhead by using the class method AMWorkflowClass.RunWorkflowAtURLWithInputError. 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 must create and initialize both the workflow and the workflow controller objects.
In either case, the workflow runs in a separate process so that any actions it contains are executed in a separate memory space. That helps to insulate your app from crashes, memory leaks, or exceptions that might occur from running the actions in the workflow.
You can display a workflow with an instance of AMWorkflowView.
Creating a Workflow ¶
- AMWorkflow.InitWithContentsOfURLError: Creates and initializes a workflow based on the contents of the specified file.
Saving Changes to a Workflow ¶
- AMWorkflow.WriteToURLError: Writes the workflow to the specified file.
Getting Information About a Workflow ¶
- AMWorkflow.Actions: An array of the workflow’s actions.
- AMWorkflow.FileURL: A URL that specifies the location of the workflow file.
- AMWorkflow.ValueForVariableWithName: Returns the value of the workflow variable with the specified name.
Working with the Workflow’s Input and Output ¶
- AMWorkflow.Input: The input data that is passed to the first action in the workflow.
- AMWorkflow.SetInput
- AMWorkflow.Output: The output data that is provided by the last action in the workflow.
Manipulating the Workflow ¶
- AMWorkflow.SetValueForVariableWithName: Sets the value of the workflow variable with the specified name.
Manipulating the Workflow’s Actions ¶
- AMWorkflow.AddAction: Adds the specified action at the end of the receiving workflow.
- AMWorkflow.InsertActionAtIndex: Inserts the specified action at the specified position of the receiving workflow.
- AMWorkflow.MoveActionAtIndexToIndex: Moves the action from the specified start position to the specified end position in the receiving workflow.
- AMWorkflow.RemoveAction: Removes the specified action from the workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkflow
func AMWorkflowFromID ¶
func AMWorkflowFromID(id objc.ID) AMWorkflow
AMWorkflowFromID constructs a AMWorkflow from an objc.ID.
An object that lets you use an Automator workflow in your app.
func NewAMWorkflow ¶
func NewAMWorkflow() AMWorkflow
NewAMWorkflow creates a new AMWorkflow instance.
func NewAMWorkflowWithContentsOfURLError ¶
func NewAMWorkflowWithContentsOfURLError(fileURL foundation.NSURL) (AMWorkflow, error)
Creates and initializes a workflow based on the contents of the specified file.
fileURL: URL that specifies the location of a workflow file.
Return Value ¶
The initialized workflow object. On error, returns nil.
Discussion ¶
See: https://developer.apple.com/documentation/Automator/AMWorkflow/init(contentsOf:)
func (AMWorkflow) Actions ¶
func (a AMWorkflow) Actions() []AMAction
An array of the workflow’s actions.
Return Value ¶
An array of actions for the workflow file. Actions are instances of classes such as AMBundleAction, AMAppleScriptAction, and AMShellScriptAction.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/actions
func (AMWorkflow) AddAction ¶
func (a AMWorkflow) AddAction(action IAMAction)
Adds the specified action at the end of the receiving workflow.
action: The action to add.
Discussion ¶
The workflow retains the action but does not copy it.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/addAction(_:)
func (AMWorkflow) Autorelease ¶
func (a AMWorkflow) Autorelease() AMWorkflow
Autorelease adds the receiver to the current autorelease pool.
func (AMWorkflow) FileURL ¶
func (a AMWorkflow) FileURL() foundation.NSURL
A URL that specifies the location of the workflow file.
Return Value ¶
URL that specifies the location of the workflow file.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/fileURL
func (AMWorkflow) InitWithContentsOfURLError ¶
func (a AMWorkflow) InitWithContentsOfURLError(fileURL foundation.NSURL) (AMWorkflow, error)
Creates and initializes a workflow based on the contents of the specified file.
fileURL: URL that specifies the location of a workflow file.
Return Value ¶
The initialized workflow object. On error, returns nil.
Discussion ¶
See: https://developer.apple.com/documentation/Automator/AMWorkflow/init(contentsOf:)
func (AMWorkflow) Input ¶
func (a AMWorkflow) Input() objectivec.IObject
The input data that is passed to the first action in the workflow.
Return Value ¶
The input for the first action in the workflow. Should be a data type the action can use, or a type that can be converted to one the action can use. Use “ to set the input data for the workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/input
func (AMWorkflow) InsertActionAtIndex ¶
func (a AMWorkflow) InsertActionAtIndex(action IAMAction, index uint)
Inserts the specified action at the specified position of the receiving workflow.
action: The action to insert.
index: The position in the receiver at which to insert the action. If the position is invalid, this method does nothing.
Discussion ¶
The workflow retains the action but does not copy it.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/insertAction(_:at:)
func (AMWorkflow) MoveActionAtIndexToIndex ¶
func (a AMWorkflow) MoveActionAtIndexToIndex(startIndex uint, endIndex uint)
Moves the action from the specified start position to the specified end position in the receiving workflow.
startIndex: The start position of the action to move.
endIndex: The end position for the action that is moved.
Discussion ¶
If either index is invalid, this method does nothing.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/moveAction(at:to:)
func (AMWorkflow) Output ¶
func (a AMWorkflow) Output() objectivec.IObject
The output data that is provided by the last action in the workflow.
Return Value ¶
The output for the for last action in the workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/output
func (AMWorkflow) RemoveAction ¶
func (a AMWorkflow) RemoveAction(action IAMAction)
Removes the specified action from the workflow.
action: The action to be removed.
Discussion ¶
The action receives an `AMAction closed` message before being released.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/removeAction(_:)
func (AMWorkflow) SetInput ¶
func (a AMWorkflow) SetInput(value objectivec.IObject)
func (AMWorkflow) SetValueForVariableWithName ¶
func (a AMWorkflow) SetValueForVariableWithName(value objectivec.IObject, variableName string) bool
Sets the value of the workflow variable with the specified name.
value: The value to set for the named variable.
variableName: The name of a variable to set the value for.
Return Value ¶
true if `variableName` was found and its value is set; otherwise false.
Discussion ¶
This method does nothing if the variable specified by `variableName` is not found.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/setValue(_:forVariableWithName:)
func (AMWorkflow) ValueForVariableWithName ¶
func (a AMWorkflow) ValueForVariableWithName(variableName string) objectivec.IObject
Returns the value of the workflow variable with the specified name.
variableName: The variable name.
Return Value ¶
The value for the variable. Returns `nil` if no variable is found with the specified name.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/valueForVariable(withName:)
func (AMWorkflow) WriteToURLError ¶
func (a AMWorkflow) WriteToURLError(fileURL foundation.NSURL) (bool, error)
Writes the workflow to the specified file.
fileURL: URL that specifies the file location to write the workflow.
Discussion ¶
You might want to save the workflow, for example, because you have made changes to a variable it contains.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/write(to:)
type AMWorkflowClass ¶
type AMWorkflowClass struct {
// contains filtered or unexported fields
}
func GetAMWorkflowClass ¶
func GetAMWorkflowClass() AMWorkflowClass
GetAMWorkflowClass returns the class object for AMWorkflow.
func (AMWorkflowClass) Alloc ¶
func (ac AMWorkflowClass) Alloc() AMWorkflow
Alloc allocates memory for a new instance of the class.
func (AMWorkflowClass) Class ¶
func (ac AMWorkflowClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (AMWorkflowClass) RunWorkflowAtURLWithInputError ¶
func (_AMWorkflowClass AMWorkflowClass) RunWorkflowAtURLWithInputError(fileURL foundation.NSURL, input objectivec.IObject) (objectivec.IObject, error)
Loads and runs the specified workflow file.
fileURL: A URL that specifies the location of a workflow file.
input: The input for the first action in the workflow. Pass `nil` if the first action doesn’t need input.
Return Value ¶
This method returns `nil` on error, or if the action completes successfully without producing output. The error argument must be examined to determine which scenario occurred. Otherwise, this method returns the output of the last action in the workflow. Your application may need to convert the data to a desired type.
Discussion ¶
Use this method to run a workflow without the overhead of performing a separate allocation, setting up a workflow controller, and so on. In situations where you need greater control, such as the ability to start and stop the workflow, use an instance of the AMWorkflowController class instead.
The workflow is run in a separate process so that any actions it contains are executed in a separate memory space. This helps to insulate the app from crashes, memory leaks, or exceptions that might occur from running the actions in the workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkflow/run(at:withInput:)
type AMWorkflowController ¶
type AMWorkflowController struct {
appkit.NSController
}
An object that lets you manage an Automator workflow in your app.
Overview ¶
A controller can run and stop a workflow and obtain information about its state. The controller’s delegate (AMWorkflowControllerDelegate) receives messages as the workflow is executed and its actions are run.
You can load and run a workflow with minimal overhead by using the AMWorkflow class method AMWorkflowClass.RunWorkflowAtURLWithInputError. Use AMWorkflowController where you need greater control, such as the ability to start and stop the workflow. In that case, you must create and initialize both the workflow and the workflow controller objects.
Accessing the Workflow ¶
- AMWorkflowController.Workflow: The controller’s workflow.
- AMWorkflowController.SetWorkflow
Accessing the Workflow View ¶
- AMWorkflowController.WorkflowView: The controller’s workflow view.
- AMWorkflowController.SetWorkflowView
Accessing the Delegate ¶
- AMWorkflowController.Delegate: The controller’s delegate.
- AMWorkflowController.SetDelegate
Controlling the Workflow ¶
- AMWorkflowController.Pause: Pauses a workflow that’s running.
- AMWorkflowController.Reset: Stops a workflow, clears any action results, and resets the workflow back to an un-run state.
- AMWorkflowController.Run: Runs the associated workflow, after first clearing any results stored by its actions during any previous run.
- AMWorkflowController.Step: In a paused workflow, runs the next action in the workflow and then pauses again.
- AMWorkflowController.Stop: Stops the associated workflow.
Getting Workflow Information ¶
- AMWorkflowController.CanRun: A Boolean value that indicates whether the controller’s workflow is able to run.
- AMWorkflowController.IsPaused: A Boolean value that indicates whether the controller’s workflow is currently paused.
- AMWorkflowController.IsRunning: A Boolean value that indicates whether the controller’s workflow is currently running.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController
func AMWorkflowControllerFromID ¶
func AMWorkflowControllerFromID(id objc.ID) AMWorkflowController
AMWorkflowControllerFromID constructs a AMWorkflowController from an objc.ID.
An object that lets you manage an Automator workflow in your app.
func NewAMWorkflowController ¶
func NewAMWorkflowController() AMWorkflowController
NewAMWorkflowController creates a new AMWorkflowController instance.
func (AMWorkflowController) Autorelease ¶
func (a AMWorkflowController) Autorelease() AMWorkflowController
Autorelease adds the receiver to the current autorelease pool.
func (AMWorkflowController) CanRun ¶
func (a AMWorkflowController) CanRun() bool
A Boolean value that indicates whether the controller’s workflow is able to run.
Return Value ¶
true if the controller’s workflow is able to run; false otherwise.
Discussion ¶
You might use this method to determine when to enable a “Run” button or other UI element you use to run the workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/canRun
func (AMWorkflowController) Delegate ¶
func (a AMWorkflowController) Delegate() AMWorkflowControllerDelegate
The controller’s delegate.
Return Value ¶
The controller’s delegate.
Discussion ¶
This object receives updates on the progress and state of the workflow controller.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/delegate
func (AMWorkflowController) Init ¶
func (a AMWorkflowController) Init() AMWorkflowController
Init initializes the instance.
func (AMWorkflowController) IsPaused ¶
func (a AMWorkflowController) IsPaused() bool
A Boolean value that indicates whether the controller’s workflow is currently paused.
Return Value ¶
true if the controller’s workflow is currently paused; false otherwise.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/isPaused
func (AMWorkflowController) IsRunning ¶
func (a AMWorkflowController) IsRunning() bool
A Boolean value that indicates whether the controller’s workflow is currently running.
Discussion ¶
true if the controller’s workflow is currently running; false otherwise. Use “ to determine whether the receiver’s workflow is currently running.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/isRunning
func (AMWorkflowController) Pause ¶
func (a AMWorkflowController) Pause(sender objectivec.IObject)
Pauses a workflow that’s running.
sender: Object that initiated the pause action.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/pause(_:)
func (AMWorkflowController) Reset ¶
func (a AMWorkflowController) Reset(sender objectivec.IObject)
Stops a workflow, clears any action results, and resets the workflow back to an un-run state.
sender: Object that initiated the reset action.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/reset(_:)
func (AMWorkflowController) Run ¶
func (a AMWorkflowController) Run(sender objectivec.IObject)
Runs the associated workflow, after first clearing any results stored by its actions during any previous run.
sender: Object that initiated the run action.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/run(_:)
func (AMWorkflowController) SetDelegate ¶
func (a AMWorkflowController) SetDelegate(value AMWorkflowControllerDelegate)
func (AMWorkflowController) SetWorkflow ¶
func (a AMWorkflowController) SetWorkflow(value IAMWorkflow)
func (AMWorkflowController) SetWorkflowView ¶
func (a AMWorkflowController) SetWorkflowView(value IAMWorkflowView)
func (AMWorkflowController) Step ¶
func (a AMWorkflowController) Step(sender objectivec.IObject)
In a paused workflow, runs the next action in the workflow and then pauses again.
sender: Object that initiated the step action.
Discussion ¶
Stepping allows a workflow to be executed one action at a time. This is useful for ensuring that the workflow is doing what it’s supposed to do, as the results of each individual action can be inspected before moving on to the next.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/step(_:)
func (AMWorkflowController) Stop ¶
func (a AMWorkflowController) Stop(sender objectivec.IObject)
Stops the associated workflow.
sender: Object that initiated the stop action.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/stop(_:)
func (AMWorkflowController) Workflow ¶
func (a AMWorkflowController) Workflow() IAMWorkflow
The controller’s workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/workflow
func (AMWorkflowController) WorkflowView ¶
func (a AMWorkflowController) WorkflowView() IAMWorkflowView
The controller’s workflow view.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController/workflowView-swift.property
type AMWorkflowControllerClass ¶
type AMWorkflowControllerClass struct {
// contains filtered or unexported fields
}
func GetAMWorkflowControllerClass ¶
func GetAMWorkflowControllerClass() AMWorkflowControllerClass
GetAMWorkflowControllerClass returns the class object for AMWorkflowController.
func (AMWorkflowControllerClass) Alloc ¶
func (ac AMWorkflowControllerClass) Alloc() AMWorkflowController
Alloc allocates memory for a new instance of the class.
func (AMWorkflowControllerClass) Class ¶
func (ac AMWorkflowControllerClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type AMWorkflowControllerDelegate ¶
type AMWorkflowControllerDelegate interface {
objectivec.IObject
}
A set of optional methods that a delegate of a workflow controller implements.
See: https://developer.apple.com/documentation/Automator/AMWorkflowControllerDelegate
type AMWorkflowControllerDelegateConfig ¶
type AMWorkflowControllerDelegateConfig struct {
// Preparing to Run
// WorkflowControllerWillRun — Notifies the delegate when the workflow controller object is about to run.
WorkflowControllerWillRun func(controller AMWorkflowController)
// Running
// WorkflowControllerDidRun — Notifies the delegate when the workflow controller object finishes running.
WorkflowControllerDidRun func(controller AMWorkflowController)
// Stopping
// WorkflowControllerWillStop — Tells the delegate that the workflow controller object is about to stop.
WorkflowControllerWillStop func(controller AMWorkflowController)
// WorkflowControllerDidStop — Tells the delegate that the workflow controller object has stopped.
WorkflowControllerDidStop func(controller AMWorkflowController)
// Handling Errors
// WorkflowControllerDidError — Notifies the delegate when the workflow encounters an error.
WorkflowControllerDidError func(controller AMWorkflowController, error_ foundation.NSError)
// Other Methods
// WorkflowControllerWillRunAction — Notifies the delegate when the specified action is about to run.
WorkflowControllerWillRunAction func(controller AMWorkflowController, action AMAction)
// WorkflowControllerDidRunAction — Notifies the delegate when the specified action finishes running.
WorkflowControllerDidRunAction func(controller AMWorkflowController, action AMAction)
}
AMWorkflowControllerDelegateConfig holds optional typed callbacks for AMWorkflowControllerDelegate methods. Set non-nil fields to register the corresponding Objective-C delegate method. Methods with nil callbacks are not registered, so [NSObject.RespondsToSelector] returns false for them — matching the Objective-C delegate pattern exactly.
See Apple Documentation for protocol details.
type AMWorkflowControllerDelegateObject ¶
type AMWorkflowControllerDelegateObject struct {
objectivec.Object
}
AMWorkflowControllerDelegateObject wraps an existing Objective-C object that conforms to the AMWorkflowControllerDelegate protocol.
func AMWorkflowControllerDelegateObjectFromID ¶
func AMWorkflowControllerDelegateObjectFromID(id objc.ID) AMWorkflowControllerDelegateObject
AMWorkflowControllerDelegateObjectFromID constructs a AMWorkflowControllerDelegateObject from an objc.ID. The object is determined to conform to the protocol at runtime.
func NewAMWorkflowControllerDelegate ¶
func NewAMWorkflowControllerDelegate(config AMWorkflowControllerDelegateConfig) AMWorkflowControllerDelegateObject
NewAMWorkflowControllerDelegate creates an Objective-C object implementing the AMWorkflowControllerDelegate protocol.
Each call registers a unique Objective-C class containing only the methods set in config. This means [NSObject.RespondsToSelector] works correctly for optional delegate methods — only non-nil callbacks are registered.
The returned AMWorkflowControllerDelegateObject satisfies the AMWorkflowControllerDelegate interface and can be passed directly to SetDelegate and similar methods.
See Apple Documentation for protocol details.
func (AMWorkflowControllerDelegateObject) BaseObject ¶
func (o AMWorkflowControllerDelegateObject) BaseObject() objectivec.Object
func (AMWorkflowControllerDelegateObject) WorkflowControllerDidError ¶
func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidError(controller IAMWorkflowController, error_ foundation.NSError)
Notifies the delegate when the workflow encounters an error.
controller: The controller object sending the message.
error: If a workflow error occurs, upon return contains an instance of NSError that describes the problem.
func (AMWorkflowControllerDelegateObject) WorkflowControllerDidRun ¶
func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidRun(controller IAMWorkflowController)
Notifies the delegate when the workflow controller object finishes running.
controller: The workflow controller object that finished running.
func (AMWorkflowControllerDelegateObject) WorkflowControllerDidRunAction ¶
func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidRunAction(controller IAMWorkflowController, action IAMAction)
Notifies the delegate when the specified action finishes running.
controller: The controller object sending the message.
action: The workflow action that ran.
func (AMWorkflowControllerDelegateObject) WorkflowControllerDidStop ¶
func (o AMWorkflowControllerDelegateObject) WorkflowControllerDidStop(controller IAMWorkflowController)
Tells the delegate that the workflow controller object has stopped.
controller: The workflow controller object that stopped.
func (AMWorkflowControllerDelegateObject) WorkflowControllerWillRun ¶
func (o AMWorkflowControllerDelegateObject) WorkflowControllerWillRun(controller IAMWorkflowController)
Notifies the delegate when the workflow controller object is about to run.
controller: The workflow controller object to run.
func (AMWorkflowControllerDelegateObject) WorkflowControllerWillRunAction ¶
func (o AMWorkflowControllerDelegateObject) WorkflowControllerWillRunAction(controller IAMWorkflowController, action IAMAction)
Notifies the delegate when the specified action is about to run.
controller: The controller object sending the message.
action: The workflow action to run.
func (AMWorkflowControllerDelegateObject) WorkflowControllerWillStop ¶
func (o AMWorkflowControllerDelegateObject) WorkflowControllerWillStop(controller IAMWorkflowController)
Tells the delegate that the workflow controller object is about to stop.
controller: The workflow controller object to stop.
type AMWorkflowView ¶
An object that lets you view and edit Automator workflows in your app.
Overview ¶
A workflow view displays an instance of AMWorkflow.
You can use Interface Builder to add an instance of AMWorkflowView to a window in your app. You can then add an AMWorkflowView object to the nib window and use the controller’s AMWorkflowController.WorkflowView outlet to connect it to the workflow view. The controller object also has AMWorkflowController.Run and AMWorkflowController.Stop actions that can be connected to buttons or other user interface elements.
Configuring the Workflow View ¶
- AMWorkflowView.IsEditable: A Boolean value that indicates whether the workflow view is editable.
- AMWorkflowView.SetEditable
- AMWorkflowView.WorkflowController: The view’s workflow controller.
- AMWorkflowView.SetWorkflowController
See: https://developer.apple.com/documentation/Automator/AMWorkflowView
func AMWorkflowViewFromID ¶
func AMWorkflowViewFromID(id objc.ID) AMWorkflowView
AMWorkflowViewFromID constructs a AMWorkflowView from an objc.ID.
An object that lets you view and edit Automator workflows in your app.
func NewAMWorkflowView ¶
func NewAMWorkflowView() AMWorkflowView
NewAMWorkflowView creates a new AMWorkflowView instance.
func (AMWorkflowView) Autorelease ¶
func (a AMWorkflowView) Autorelease() AMWorkflowView
Autorelease adds the receiver to the current autorelease pool.
func (AMWorkflowView) Init ¶
func (a AMWorkflowView) Init() AMWorkflowView
Init initializes the instance.
func (AMWorkflowView) IsEditable ¶
func (a AMWorkflowView) IsEditable() bool
A Boolean value that indicates whether the workflow view is editable.
See: https://developer.apple.com/documentation/Automator/AMWorkflowView/isEditable
func (AMWorkflowView) SetEditable ¶
func (a AMWorkflowView) SetEditable(value bool)
func (AMWorkflowView) SetWorkflowController ¶
func (a AMWorkflowView) SetWorkflowController(value IAMWorkflowController)
func (AMWorkflowView) WorkflowController ¶
func (a AMWorkflowView) WorkflowController() IAMWorkflowController
The view’s workflow controller.
See: https://developer.apple.com/documentation/Automator/AMWorkflowView/workflowController
type AMWorkflowViewClass ¶
type AMWorkflowViewClass struct {
// contains filtered or unexported fields
}
func GetAMWorkflowViewClass ¶
func GetAMWorkflowViewClass() AMWorkflowViewClass
GetAMWorkflowViewClass returns the class object for AMWorkflowView.
func (AMWorkflowViewClass) Alloc ¶
func (ac AMWorkflowViewClass) Alloc() AMWorkflowView
Alloc allocates memory for a new instance of the class.
func (AMWorkflowViewClass) Class ¶
func (ac AMWorkflowViewClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
type AMWorkspace ¶
type AMWorkspace struct {
objectivec.Object
}
A workspace for running an Automator workflow.
Overview ¶
The AMWorkspace class provides access to the shared workspace in the Automator framework, where you can run workflows without a workflow controller. Use AMWorkspaceClass.SharedWorkspace to access the shared workspace and AMWorkspace.RunWorkflowAtPathWithInputError to run your workflow in it.
Running Workflows ¶
- AMWorkspace.RunWorkflowAtPathWithInputError: Loads and runs the specified workflow file.
See: https://developer.apple.com/documentation/Automator/AMWorkspace
func AMWorkspaceFromID ¶
func AMWorkspaceFromID(id objc.ID) AMWorkspace
AMWorkspaceFromID constructs a AMWorkspace from an objc.ID.
A workspace for running an Automator workflow.
func NewAMWorkspace ¶
func NewAMWorkspace() AMWorkspace
NewAMWorkspace creates a new AMWorkspace instance.
func (AMWorkspace) Autorelease ¶
func (a AMWorkspace) Autorelease() AMWorkspace
Autorelease adds the receiver to the current autorelease pool.
func (AMWorkspace) RunWorkflowAtPathWithInputError ¶
func (a AMWorkspace) RunWorkflowAtPathWithInputError(path string, input objectivec.IObject) (objectivec.IObject, error)
Loads and runs the specified workflow file.
path: A path that specifies the location of the workflow file.
input: The input for the first action in the workflow. Pass `nil` if the first action doesn’t need input.
Return Value ¶
`nil` if an error occurs or if the action completes successfully without producing output; otherwise, the output of the last action in the workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkspace/runWorkflow(atPath:withInput:)
type AMWorkspaceClass ¶
type AMWorkspaceClass struct {
// contains filtered or unexported fields
}
func GetAMWorkspaceClass ¶
func GetAMWorkspaceClass() AMWorkspaceClass
GetAMWorkspaceClass returns the class object for AMWorkspace.
func (AMWorkspaceClass) Alloc ¶
func (ac AMWorkspaceClass) Alloc() AMWorkspace
Alloc allocates memory for a new instance of the class.
func (AMWorkspaceClass) Class ¶
func (ac AMWorkspaceClass) Class() objc.Class
Class returns the underlying Objective-C class pointer.
func (AMWorkspaceClass) SharedWorkspace ¶
func (_AMWorkspaceClass AMWorkspaceClass) SharedWorkspace() AMWorkspace
The shared workspace object.
See: https://developer.apple.com/documentation/Automator/AMWorkspace/shared
type IAMAction ¶
type IAMAction interface {
objectivec.IObject
// Initializes the action with the specified definition.
InitWithDefinitionFromArchive(dict foundation.INSDictionary, archived bool) AMAction
// Loads an Automator action from a file URL.
InitWithContentsOfURLError(fileURL foundation.NSURL) (AMAction, error)
// Examines the parameters and other configuration information specified in the passed dictionary and adds its own information to it if appropriate.
WriteToDictionary(dictionary foundation.INSDictionary)
// Requests the action to perform its task using the specified input.
RunWithInputError(input objectivec.IObject) (objectivec.IObject, error)
// Causes Automator to wait for notification that the action has completed execution, which allows the action to perform an asynchronous operation.
RunAsynchronouslyWithInput(input objectivec.IObject)
// Causes the action to stop running and return an error, which, in turn, causes the workflow to stop.
FinishRunningWithError(error_ foundation.NSError)
// Provides an opportunity for an action to perform cleanup operations, such as closing windows and deallocating memory.
WillFinishRunning()
// Stops the action from running.
Stop()
// Resets the action to its initial state.
Reset()
// Allows the action to synchronize its information with settings in another app.
Activated()
// Allows the action to initialize its user interface.
Opened()
// Requests the action to update its user interface from its stored parameters, which have changed.
ParametersUpdated()
// Requests the action to update its stored set of parameters from the settings in the action’s user interface.
UpdateParameters()
// The name of the action.
Name() string
// A float value between 0 and 1, which indicates how far along the action is while processing.
ProgressValue() float64
SetProgressValue(value float64)
// A Boolean value that indicates whether the action acts upon its input or the input is ignored.
IgnoresInput() bool
// The action’s output.
Output() objectivec.IObject
SetOutput(value objectivec.IObject)
// The type of input, in UTI format, of the input received by the action.
SelectedInputType() string
SetSelectedInputType(value string)
// The type of output, in UTI format, of the output to be produced by the action.
SelectedOutputType() string
SetSelectedOutputType(value string)
// A Boolean value that indicates whether the user clicked the stop button on the parent workflow.
IsStopped() bool
// Invoked by Automator when the receiving action is removed from a workflow, allowing it to perform cleanup operations.
Closed()
}
An interface definition for the AMAction class.
Initializing and Encoding ¶
- IAMAction.InitWithDefinitionFromArchive: Initializes the action with the specified definition.
- IAMAction.InitWithContentsOfURLError: Loads an Automator action from a file URL.
- IAMAction.WriteToDictionary: Examines the parameters and other configuration information specified in the passed dictionary and adds its own information to it if appropriate.
Controlling the Action ¶
- IAMAction.RunWithInputError: Requests the action to perform its task using the specified input.
- IAMAction.RunAsynchronouslyWithInput: Causes Automator to wait for notification that the action has completed execution, which allows the action to perform an asynchronous operation.
- IAMAction.FinishRunningWithError: Causes the action to stop running and return an error, which, in turn, causes the workflow to stop.
- IAMAction.WillFinishRunning: Provides an opportunity for an action to perform cleanup operations, such as closing windows and deallocating memory.
- IAMAction.Stop: Stops the action from running.
- IAMAction.Reset: Resets the action to its initial state.
Initializing and Synchronizing the Action User Interface ¶
- IAMAction.Activated: Allows the action to synchronize its information with settings in another app.
- IAMAction.Opened: Allows the action to initialize its user interface.
Updating Action Parameters ¶
- IAMAction.ParametersUpdated: Requests the action to update its user interface from its stored parameters, which have changed.
- IAMAction.UpdateParameters: Requests the action to update its stored set of parameters from the settings in the action’s user interface.
Getting Action Information ¶
- IAMAction.Name: The name of the action.
- IAMAction.ProgressValue: A float value between 0 and 1, which indicates how far along the action is while processing.
- IAMAction.SetProgressValue
- IAMAction.IgnoresInput: A Boolean value that indicates whether the action acts upon its input or the input is ignored.
- IAMAction.Output: The action’s output.
- IAMAction.SetOutput
- IAMAction.SelectedInputType: The type of input, in UTI format, of the input received by the action.
- IAMAction.SetSelectedInputType
- IAMAction.SelectedOutputType: The type of output, in UTI format, of the output to be produced by the action.
- IAMAction.SetSelectedOutputType
- IAMAction.IsStopped: A Boolean value that indicates whether the user clicked the stop button on the parent workflow.
Performing Cleanup Operations ¶
- IAMAction.Closed: Invoked by Automator when the receiving action is removed from a workflow, allowing it to perform cleanup operations.
See: https://developer.apple.com/documentation/Automator/AMAction
type IAMBundleAction ¶
type IAMBundleAction interface {
IAMAction
// Allows the action object to perform setup tasks requiring the presence of all bundle objects.
AwakeFromBundle()
// The action’s bundle object.
Bundle() foundation.Bundle
// A Boolean value that indicates whether the action has a view associated with it.
HasView() bool
// The action’s view object.
View() appkit.NSView
// The action’s parameters.
Parameters() foundation.INSDictionary
SetParameters(value foundation.INSDictionary)
}
An interface definition for the AMBundleAction class.
Initializing the Action ¶
- IAMBundleAction.AwakeFromBundle: Allows the action object to perform setup tasks requiring the presence of all bundle objects.
Managing Action Properties ¶
- IAMBundleAction.Bundle: The action’s bundle object.
- IAMBundleAction.HasView: A Boolean value that indicates whether the action has a view associated with it.
- IAMBundleAction.View: The action’s view object.
- IAMBundleAction.Parameters: The action’s parameters.
- IAMBundleAction.SetParameters
See: https://developer.apple.com/documentation/Automator/AMBundleAction
type IAMShellScriptAction ¶
type IAMShellScriptAction interface {
IAMBundleAction
// A string to use as the delimiter between items in the string passed to the action through standard input.
InputFieldSeparator() string
// A string to use as a delimiter in the string output by the action.
OutputFieldSeparator() string
// A Boolean value that indicates whether you want automatic remapping of carriage return (`\r`) to newline (`\n`) characters in the input string.
RemapLineEndings() bool
}
An interface definition for the AMShellScriptAction class.
Handling the I/O Separator Character ¶
- IAMShellScriptAction.InputFieldSeparator: A string to use as the delimiter between items in the string passed to the action through standard input.
- IAMShellScriptAction.OutputFieldSeparator: A string to use as a delimiter in the string output by the action.
- IAMShellScriptAction.RemapLineEndings: A Boolean value that indicates whether you want automatic remapping of carriage return (`\r`) to newline (`\n`) characters in the input string.
See: https://developer.apple.com/documentation/Automator/AMShellScriptAction
type IAMWorkflow ¶
type IAMWorkflow interface {
objectivec.IObject
// Creates and initializes a workflow based on the contents of the specified file.
InitWithContentsOfURLError(fileURL foundation.NSURL) (AMWorkflow, error)
// Writes the workflow to the specified file.
WriteToURLError(fileURL foundation.NSURL) (bool, error)
// An array of the workflow’s actions.
Actions() []AMAction
// A URL that specifies the location of the workflow file.
FileURL() foundation.NSURL
// Returns the value of the workflow variable with the specified name.
ValueForVariableWithName(variableName string) objectivec.IObject
// The input data that is passed to the first action in the workflow.
Input() objectivec.IObject
SetInput(value objectivec.IObject)
// The output data that is provided by the last action in the workflow.
Output() objectivec.IObject
// Sets the value of the workflow variable with the specified name.
SetValueForVariableWithName(value objectivec.IObject, variableName string) bool
// Adds the specified action at the end of the receiving workflow.
AddAction(action IAMAction)
// Inserts the specified action at the specified position of the receiving workflow.
InsertActionAtIndex(action IAMAction, index uint)
// Moves the action from the specified start position to the specified end position in the receiving workflow.
MoveActionAtIndexToIndex(startIndex uint, endIndex uint)
// Removes the specified action from the workflow.
RemoveAction(action IAMAction)
}
An interface definition for the AMWorkflow class.
Creating a Workflow ¶
- IAMWorkflow.InitWithContentsOfURLError: Creates and initializes a workflow based on the contents of the specified file.
Saving Changes to a Workflow ¶
- IAMWorkflow.WriteToURLError: Writes the workflow to the specified file.
Getting Information About a Workflow ¶
- IAMWorkflow.Actions: An array of the workflow’s actions.
- IAMWorkflow.FileURL: A URL that specifies the location of the workflow file.
- IAMWorkflow.ValueForVariableWithName: Returns the value of the workflow variable with the specified name.
Working with the Workflow’s Input and Output ¶
- IAMWorkflow.Input: The input data that is passed to the first action in the workflow.
- IAMWorkflow.SetInput
- IAMWorkflow.Output: The output data that is provided by the last action in the workflow.
Manipulating the Workflow ¶
- IAMWorkflow.SetValueForVariableWithName: Sets the value of the workflow variable with the specified name.
Manipulating the Workflow’s Actions ¶
- IAMWorkflow.AddAction: Adds the specified action at the end of the receiving workflow.
- IAMWorkflow.InsertActionAtIndex: Inserts the specified action at the specified position of the receiving workflow.
- IAMWorkflow.MoveActionAtIndexToIndex: Moves the action from the specified start position to the specified end position in the receiving workflow.
- IAMWorkflow.RemoveAction: Removes the specified action from the workflow.
See: https://developer.apple.com/documentation/Automator/AMWorkflow
type IAMWorkflowController ¶
type IAMWorkflowController interface {
appkit.INSController
// The controller’s workflow.
Workflow() IAMWorkflow
SetWorkflow(value IAMWorkflow)
// The controller’s workflow view.
WorkflowView() IAMWorkflowView
SetWorkflowView(value IAMWorkflowView)
// The controller’s delegate.
Delegate() AMWorkflowControllerDelegate
SetDelegate(value AMWorkflowControllerDelegate)
// Pauses a workflow that’s running.
Pause(sender objectivec.IObject)
// Stops a workflow, clears any action results, and resets the workflow back to an un-run state.
Reset(sender objectivec.IObject)
// Runs the associated workflow, after first clearing any results stored by its actions during any previous run.
Run(sender objectivec.IObject)
// In a paused workflow, runs the next action in the workflow and then pauses again.
Step(sender objectivec.IObject)
// Stops the associated workflow.
Stop(sender objectivec.IObject)
// A Boolean value that indicates whether the controller’s workflow is able to run.
CanRun() bool
// A Boolean value that indicates whether the controller’s workflow is currently paused.
IsPaused() bool
// A Boolean value that indicates whether the controller’s workflow is currently running.
IsRunning() bool
}
An interface definition for the AMWorkflowController class.
Accessing the Workflow ¶
- IAMWorkflowController.Workflow: The controller’s workflow.
- IAMWorkflowController.SetWorkflow
Accessing the Workflow View ¶
- IAMWorkflowController.WorkflowView: The controller’s workflow view.
- IAMWorkflowController.SetWorkflowView
Accessing the Delegate ¶
- IAMWorkflowController.Delegate: The controller’s delegate.
- IAMWorkflowController.SetDelegate
Controlling the Workflow ¶
- IAMWorkflowController.Pause: Pauses a workflow that’s running.
- IAMWorkflowController.Reset: Stops a workflow, clears any action results, and resets the workflow back to an un-run state.
- IAMWorkflowController.Run: Runs the associated workflow, after first clearing any results stored by its actions during any previous run.
- IAMWorkflowController.Step: In a paused workflow, runs the next action in the workflow and then pauses again.
- IAMWorkflowController.Stop: Stops the associated workflow.
Getting Workflow Information ¶
- IAMWorkflowController.CanRun: A Boolean value that indicates whether the controller’s workflow is able to run.
- IAMWorkflowController.IsPaused: A Boolean value that indicates whether the controller’s workflow is currently paused.
- IAMWorkflowController.IsRunning: A Boolean value that indicates whether the controller’s workflow is currently running.
See: https://developer.apple.com/documentation/Automator/AMWorkflowController
type IAMWorkflowView ¶
type IAMWorkflowView interface {
appkit.INSView
// A Boolean value that indicates whether the workflow view is editable.
IsEditable() bool
SetEditable(value bool)
// The view’s workflow controller.
WorkflowController() IAMWorkflowController
SetWorkflowController(value IAMWorkflowController)
}
An interface definition for the AMWorkflowView class.
Configuring the Workflow View ¶
- IAMWorkflowView.IsEditable: A Boolean value that indicates whether the workflow view is editable.
- IAMWorkflowView.SetEditable
- IAMWorkflowView.WorkflowController: The view’s workflow controller.
- IAMWorkflowView.SetWorkflowController
See: https://developer.apple.com/documentation/Automator/AMWorkflowView
type IAMWorkspace ¶
type IAMWorkspace interface {
objectivec.IObject
// Loads and runs the specified workflow file.
RunWorkflowAtPathWithInputError(path string, input objectivec.IObject) (objectivec.IObject, error)
}
An interface definition for the AMWorkspace class.
Running Workflows ¶
- IAMWorkspace.RunWorkflowAtPathWithInputError: Loads and runs the specified workflow file.
See: https://developer.apple.com/documentation/Automator/AMWorkspace
Source Files
¶
- am_action.gen.go
- am_bundle_action.gen.go
- am_shell_script_action.gen.go
- am_workflow.gen.go
- am_workflow_controller.gen.go
- am_workflow_controller_delegate_protocol.gen.go
- am_workflow_view.gen.go
- am_workspace.gen.go
- delegate_class_counter.gen.go
- doc.gen.go
- enums.gen.go
- functions.gen.go
- generate.go
- types.gen.go
- undefined_types.gen.go