SharePanel Class

An interface that can display the system share interaction for the given items.

Instance properties of the the SharePanel class:

Instance functions of the SharePanel class:

AirDrop OmniFocus Database Backup

Here is an example script that use the SharePanel class to AirDrop a backup copy of the OmniFocus database:

var fileTypeID = 'com.omnigroup.omnifocus.filetype.ofocus-backup' var defaultName = "OmniFocus DB Backup" var wrapperPromise = document.makeFileWrapper(defaultName, fileTypeID) wrapperPromise.then(function(wrapper){ new SharePanel([wrapper]).show() })
omnifocus://localhost/omnijs-run?script=try%7Bvar%20fileTypeID%20%3D%20%27com%2Eomnigroup%2Eomnifocus%2Efiletype%2Eofocus%2Dbackup%27%0Avar%20defaultName%20%3D%20%22OmniFocus%20DB%20Backup%22%0Avar%20wrapperPromise%20%3D%20document%2EmakeFileWrapper%28defaultName%2C%20fileTypeID%29%0AwrapperPromise%2Ethen%28function%28wrapper%29%7B%0A%09new%20SharePanel%28%5Bwrapper%5D%29%2Eshow%28%29%0A%7D%29%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D

When the script is run, the share sheet appears from which you can select the option to AirDrop the exported file:

share-sheet airdrop-dialog

Plug-In: Share Clipboard Text

Here’s a useful plug-in that summons the system Share Panel to share the current text on the clipboard. Great for creating a new Apple note, or Drafts document!

/*{ "type": "action", "targets": ["omnifocus", "omniplan", "omnioutliner", "omnigraffle"], "author": "Otto Automator", "identifier": "com.omni-automation.all.share-clipboard-text", "version": "1.0", "description": "This plug-in will display the system Share Panel for sharing the current text contents of the pasteboard.", "label": "Share Clipboard Text", "shortLabel": "Share Clipboard Text" }*/ (() => { var action = new PlugIn.Action(function(selection, sender){ // action code // selection options: tasks, projects, folders, tags, allObjects var clipboard = Pasteboard.general.string new SharePanel([clipboard]).show() }); action.validate = function(selection, sender){ // validation code // selection options: tasks, projects, folders, tags, allObjects return (Pasteboard.general.string.length > 0) }; return action; })();

DISCLAIMER