Using Omni Automation with Automator

Using the provided “Run Omni Automation Script” Automator action, you can include and execute Omni Automation scripts from within an Automator workflow on macOS.

The action interface

The “Run Omni Automation Script” Automator action is designed to execute the Omni Automation scripts you enter in the action’s interface, when the hosting workflow is executed.

While the hosting workflow is open in Automator, the action displays controls for testing the entered script:


Script Execution

It is important to note the following:

Example Automator Workflow

In this example Automator workflow, the paragraphs of the frontmost TextEdit are added to the current OmniOutliner document as individual rows.

The first action in the workflow “Run JavaScript” uses the built-in Apple-Events-based JavaScript support in macOS (JXA*) to retrieve the paragraphs of the frontmost TextEdit document. Note that the last line of the action’s script converts the generated JavaScript array into a JSON string object, for use later in the workflow by the “Run Omni Automation Script” action.

* JavaScript for Automation (JXA) is an OSA (Open Scripting Architecture) script language in macOS. Introduced in OS X Yosemite, JXA is a peer of the AppleScript language and as such has access to all macOS scriptable apps, frameworks, and native UNIX utilities. Here are links to the JXA Release Notes and a 23-minute training video.

In the second action, the result of the first action is stored into a new Workflow variable which is inserted into the Omni Automation script. When the workflow is executed, the inserted variable will be replaced with the JavaScript array generated by the first action.

The Omni Automation script in the last action targets the OmniOutliner application, iterating the passed-in array and creating a new outline row for each of the paragraph items in the array.



The following downloadable items are provided as instructional material, with no guarantees. USE AT YOUR OWN RISK

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

The Automator Action

The example Automator action file (v1.2).

To install the Automator action, unpack its ZIP archive, and double-click the action file. The following installation dialog will appear:


Click the “Install” button and the action file will be placed in the Automator folder in your home Library folder, and the following installation confirmation dialog will be displayed:


The “Run Omni Automation Script” action will now be available in the Automator action library.

The Automator Workflow

The example Automator workflow file.

The Xcode Project

The “Run Omni Automation Script” action is created in Xcode using the AppleScriptObj-C programming language and Apple’s AMWorkflow, AMBundleAction, and AMAction frameworks.

The example Xcode project files.

Selected Paragraphs to Outline Workflow

Here’s a variation of the first workflow that is a service that creates a new outline using the paragraphs of the selected text as rows.


DOWNLOAD the workflow file.

Here’s the workflow as a Touch Bar Quick Action in macOS Mojave:

All About Automator

If you’re intersted in finding out more about Automator, watch this video and visit the Automator website.


This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.