OmniOutliner & Omni Automation

OmniOutliner is a flexible program for creating, collecting, and organizing information. Whether you’re keeping track of tasks for a project or putting together an outline for a book or research paper, OmniOutliner has everything you need to get the details just right. The Professional Edition adds a full suite of styling, customization, and management tools to get your outlines looking just the way you want.

And with Omni Automation and OmniOutliner, you can streamline how you work, delivering enhanced productivity and creative uses of data and design.

3rd-Party Plug-In Collection

OmniOutliner Plug-Ins by Taxyovio is a collection of Omni Automation scripts for OmniOutliner, organized into five bundle plug-ins:

The Application Object

In Omni Automation, the OmniOutliner application object has properties (name, version) and elements (documents, windows). In a script, the application object is represented as: app

If you entered just “app” in the OmniOutliner console window and executed the line, the result would be a reference to the application object:

To get the name of the OS the app is running on:

Properties: name

The value of the name property of the application object is a string representing the name of the OmniGraffle application.

The value of the application name property is read-only.

Properties: Key Down Properties

The following application properties can be used by scripts to determine if the standard modifier keys are pressed when the script is run:

Properties: version

The value of the version property of the application object is a string representing the version number of the OmniOutliner application.

The value of the application version property is read-only.

To create a new version object:

To extract the version string from a version object:

Comparing Versions

There are four methods you can use for comparing version objects:

Here are functions demonstrating their use:

function isBeforeCurVers(versStrToCheck){ curVers = app.userVersion curVersStr = curVers.versionString versToCheck = new Version(versStrToCheck) result = versToCheck.isBefore(curVers) console.log(versStrToCheck + ' is before ' + curVersStr + " = " + result) return result } function isEqualToCurVers(versStrToCheck){ curVers = app.userVersion curVersStr = curVers.versionString versToCheck = new Version(versStrToCheck) result = versToCheck.equals(curVers) console.log(versStrToCheck + ' equals ' + curVersStr + " = " + result) return result } function isAtLeastCurVers(versStrToCheck){ curVers = app.userVersion curVersStr = curVers.versionString versToCheck = new Version(versStrToCheck) result = versToCheck.atLeast(curVers) console.log(versStrToCheck + ' is at least ' + curVersStr + " = " + result) return result } function isAfterCurVers(versStrToCheck){ curVers = app.userVersion curVersStr = curVers.versionString versToCheck = new Version(versStrToCheck) result = versToCheck.isAfter(curVers) console.log(versStrToCheck + ' is after ' + curVersStr + " = " + result) return result }

Open an Existing Document

To open an OmniOutliner document file, a file URL is passed to the openDocument application method. This handler attempts to open the specified document and to return a reference to it asynchronously. If the document is already open, the reference to the open document is passed along.

Note that due to platform sandboxing restrictions, opening the document may fail if the application doesn’t have currently permission to access the given file URL. The document, if any, that is associated with the calling script can be passed along to help grant permission to open the new document.

The passed in function will return two arguments: the first (result) will be either either the Document reference or an Error. On success, the second argument (wasOpen) is a Boolean value specifying whether the document was already open.


A an example, here is a script that uses the FilePicker class to prompt the user to locate and select an OmniOutliner document and then open the chosen document:

var picker = new FilePicker() picker.folders = false picker.multiple = false var aFileType = new FileType("com.omnigroup.omnioutliner.xmlooutline", "com.omnigroup.omnioutliner.xmlooutline-package") picker.types = [aFileType] var pickerPromise = pickerPromise.then(function(urlsArray){ var fileURL = urlsArray[0] app.openDocument( document, fileURL, function(doc,wasOpen){ var baseItem = doc.editors[0].rootNode.object baseItem.addChild(null,function(item){item.topic = 'HELLO WORLD'}) } ) })

 01  Create a new instance of the FilePicker class and store a reference to it in the variable: picker

 02-03  Set the properties of the file picker to select a single document file.

 04  Indicate the file types that can be selected within the file picker. In this case, the bundle and single-file version of the standard OmniOutliner document format.

 05  Set the file types for the file picker to the stored list of file types.

 06  Use the show() function to display the file picker. The resulting JavaScript promise object is stored in the variable: pickerPromise

 07-17  Use the then() method with the stored promise object to process the array of URLs chosen in the file picker.

 08  Since multiple selections were not allowed, the resulting file URL will be the first in the array of one.

 09-16  The OmniOutliner openDocument(…) is called on the application object, passing in the chosen file URL to the then(…) callback function.

 12-15  The callback function of the openDocument(…) command will pass-in a reference to the newly created document, and a boolean value indicating if it was already open.

 13  To create a new item at the start of the outline, a reference to the rootNode of the newly opened document is created by specifying the hierarchical chain: document > editors > rootNode. In most scripts that target the current document, you only need to use rootNode by itself, but since the target document is being addressed by a script running in another document’s model, you must include the target document in the rootNode reference. The object property of the rootNode will return a reference to its corresponding rootItem.

 14  The addItem(…) function is then called on the derived rootItem to create a new item (row) at the end of the outline.


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