Solitary Actions (Simple PlugIn)
In addition to creating and running actions as components in a Plug-In, actions can be written and delivered as stand-alone plug-in files that post a single entry in the Automation menu.
Unlike plugin actions, solitary actions include their identifying metadata in action file as commented object entries at the top of the action script. Note the value of the targets property (line 3) is an array containing the application name or names, targeted by the action.
New File Extension Support
The file extensions used for Omni Automation plug-ins now include app-specific extensions for single-file plug-ins, matching those currently used for plug-in bundles. These changes will be reflected in each of the Omni applications as they are updated over the following months. (posted 7/2020)
The five supported file extensions are:
With the new app-specific file extension support, the plug-in installation process is simplified:
Installing Plug-Ins
Once the action has been written, save it with the file extension of “omnijs” (see file extension information above) and place it within the target application’s Plug-Ins folder, accessed by choosing “Plug-Ins…” from the Automation menu. See the section on Plug-In Installation for detailed instructions.
Solitary Plug-In Metadata
NOTE: the following are the available metadata keys for the action header:
Here is the template for a solitary action (Simple PlugIn):
Solitary Action Template | ||
01 | /*{ | |
02 | "type": "action", | |
03 | "targets": ["omnioutliner", "omnigraffle","omniplan","omnifocus"], | |
04 | "author": "Your Name or Company", | |
05 | "identifier": "com.youOrCompany.appInitials.actionName", | |
06 | "version": "1.0", | |
07 | "description": "Description of script.", | |
08 | "label": "Script Name for Automation Menu", | |
09 | "shortLabel": "Script Name for Toolbar Buttons" | |
10 | }*/ | |
11 | ||
12 | (() => { | |
13 | ||
14 | var action = new PlugIn.Action(function(selection, sender) { | |
15 | // action code | |
16 | }); | |
17 | ||
18 | action.validate = function(selection, sender) { | |
19 | // validation code | |
20 | return true | |
21 | }; | |
22 | ||
23 | return action; | |
24 | })(); |
Here’s the solitary action template for an OmniOutliner action:
OmniOutliner Action Template | ||
01 | /*{ | |
02 | "type": "action", | |
03 | "targets": ["omnioutliner"], | |
04 | "author": "Your Name or Company", | |
05 | "identifier": "com.youOrCompany.OO.actionName", | |
06 | "version": "1.0", | |
07 | "description": "Description of script.", | |
08 | "label": "Script Name for Automation Menu", | |
09 | "shortLabel": "Script Name for Toolbar Buttons" | |
10 | }*/ | |
11 | ||
12 | (() => { | |
13 | ||
14 | var action = new PlugIn.Action(function(selection, sender){ | |
15 | // action code | |
16 | // selection options: columns, document, editor, items, nodes, styles | |
17 | // action code goes here | |
18 | }); | |
19 | ||
20 | action.validate = function(selection, sender){ | |
21 | // validation code | |
22 | // selection options: columns, document, editor, items, nodes, styles | |
23 | // validation code goes here | |
24 | }; | |
25 | ||
26 | return action; | |
27 | })(); |
For example, here’s a solitary action template for processing the selected items in an OmniOutliner document:
OmniOutliner Action: Process Selected Items | ||
01 | /*{ | |
02 | "type": "action", | |
03 | "targets": ["omnioutliner"], | |
04 | "author": "Your Name or Company", | |
05 | "identifier": "com.youOrCompany.OO.actionName", | |
06 | "version": "1.0", | |
07 | "description": "A script for processing selected outline items.", | |
08 | "label": "Process Selected Items", | |
09 | "shortLabel": "Selected Rows" | |
10 | }*/ | |
11 | ||
12 | (() => { | |
13 | ||
14 | var action = new PlugIn.Action(function(selection, sender){ | |
15 | // action code | |
16 | // selection options: columns, document, editor, items, nodes, styles | |
17 | selection.items.forEach(function(item){ | |
18 | // processing statements go here | |
19 | }) | |
20 | }); | |
21 | ||
22 | action.validate = function(selection, sender){ | |
23 | // validation code | |
24 | // selection options: columns, document, editor, items, nodes, styles | |
25 | return (selection.items.length > 0) | |
26 | }; | |
27 | ||
28 | return action; | |
29 | })(); |
Here’s the solitary action template for an OmniGraffle action:
OmniGraffle Action Template | ||
01 | /*{ | |
02 | "type": "action", | |
03 | "targets": ["omnigraffle"], | |
04 | "author": "Your Name or Company", | |
05 | "identifier": "com.youOrCompany.actionName", | |
06 | "version": "1.0", | |
07 | "description": "Description of script.", | |
08 | "label": "Script Name for Automation Menu", | |
09 | "shortLabel": "Script Name for Toolbar Buttons" | |
10 | }*/ | |
11 | ||
12 | (() => { | |
13 | ||
14 | var action = new PlugIn.Action(function(selection, sender){ | |
15 | // action code | |
16 | // selection options: canvas, graphics, lines, solids | |
17 | // action code goes here | |
18 | }); | |
19 | ||
20 | action.validate = function(selection, sender){ | |
21 | // validation code | |
22 | // selection options: canvas, graphics, lines, solids | |
23 | // validation code goes here | |
24 | }; | |
25 | ||
26 | return action; | |
27 | })(); |
For example, an action for processing selected solids in OmniGraffle:
OmniGraffle Action: Process Selected Solids | ||
01 | /*{ | |
02 | "type": "action", | |
03 | "targets": ["omnigraffle"], | |
04 | "author": "Your Name or Company", | |
05 | "identifier": "com.youOrCompany.actionName", | |
06 | "version": "1.0", | |
07 | "description": "A script that processes selected solids.", | |
08 | "label": "Process Selected Solids", | |
09 | "shortLabel": "Process Solids" | |
10 | }*/ | |
11 | ||
12 | (() => { | |
13 | ||
14 | var action = new PlugIn.Action(function(selection, sender){ | |
15 | // action code | |
16 | // selection options: canvas, graphics, lines, solids | |
17 | selection.solids.forEach(function(solid){ | |
18 | // processing statements go here | |
19 | }) | |
20 | }); | |
21 | ||
22 | action.validate = function(selection, sender){ | |
23 | // validation code | |
24 | // selection options: canvas, graphics, lines, solids | |
25 | return (selection.solids.length > 0) | |
26 | }; | |
27 | ||
28 | return action; | |
29 | })(); |
Action Template Generators
To make creating a solitary action a simpler process, we’ve provided an interactive web interface for generating the solitary action template to fit a variety of scenarios.
Just fill in the metadata and choose the type of input for the action and the webpage will generate the action template, ready for your custom Omni Automation code.
OmniGraffle: omni-automation.com/ogac
OmniOutliner: omni-automation.com/ooac
OmniPlan: omni-automation.com/opac
OmniFocus: omni-automation.com/ofac
Installing Actions and Plug-ins
Detailed instructions regarding the installation of plug-ins can be found here.
This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.