A pasteboard is essentially the same thing as the clipboard you’re already accustomed to using with “Copy” and “Paste” commands.

Using Omni Automation you can copy content to and from the user clipboard, and you can create instances of pasteboards (clipboards) for temporary use as well.

Pasteboard Properties

Here are the properties of an instance of the Pasteboard class:

The general property can be used to access the clipboard (pasteboard) used by the user. For example, here is a script that uses the copyNodes() method of the Editor class to set the contents of the general pasteboard (clipboard) to the currently selected outline content:

editor = document.editors[0] editor.copyNodes(editor.selectedNodes, Pasteboard.general)

And here's a script for pasting the current OmniOutliner selection into OmniFocus:

editor = document.editors[0] editor.copyNodes(editor.selectedNodes, Pasteboard.general) url = URL.fromString('omnifocus://localhost/paste'){})

Here’s a variation of the previous script that will copy the selection to the general clipboard and generate a new mail message in which you can manually paste the content of the document selection:

editor = document.editors[0] editor.copyNodes(editor.selectedNodes, Pasteboard.general) new Email().generate()
editor = document.editors[0] editor.copyNodes(editor.selectedNodes, Pasteboard.general) urlStr = 'workflow://run-workflow?name=Clipboard%20to%20PDF&input=clipboard' URL.fromString(urlStr).call(function(msg){})
/*{ "type": "action", "targets": ["omnioutliner"], "author": "Your Name or Company", "description": "Description of this action.", "label": "The menu item text", "paletteLabel": "Palette Text" }*/ var _ = function(){ var action = new PlugIn.Action(function(selection, sender) { // action code // selection options: columns, document, editor, items, nodes, styles editor.copyNodes(selection.nodes, Pasteboard.general) urlStr = 'workflow://run-workflow?name=YOUR%WORKFLOW%20NAME&input=clipboard' URL.fromString(urlStr).call(function(msg){}) }); action.validate = function(selection, sender) { // validation code // selection options: columns, document, editor, items, nodes, styles if(selection.nodes.length > 0){return true} else {return false} }; return action; }(); _;

Here's a script for iOS that puts the selected items on the user clipboard and calls an Apple Workflow workflow (named “Clipboard to PDF”) that uses the clipboard as input:

A workflow that converts the clipboard to a PDF file and opens it in Adobe Acrobat:

Clipboard to PDF Workflow

Documentation concerning the Workflow URL scheme is available here. Note that there is no need to begin with workflow actions retrieving the clipboard contents, as the clipboard’s contents are automatically passed to the first action in the workflow.

Pasteboard Methods (functions)

Here are the methods used with an instance of the Pasteboard class:

Copy and Paste with Pasteboard

Here’s an example script that uses properties and methods of the Editor and Pasteboard classes to copy the selected items and paste copies of them into the outline at the beginning.

editor = document.editors[0] nodes = editor.selectedNodes if (nodes.length > 0){ pb = Pasteboard.makeUnique() editor.copyNodes(nodes,pb) editor.paste(pb,editor.rootNode,0) }
editor = document.editors[0] nodes = editor.selectedNodes if (nodes.length > 0){ pb = Pasteboard.makeUnique() editor.copyNodes(nodes,pb) editor.paste(pb) }

If an insertion destination is not specified when using the paste() method, the pasteboard content is placed 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.