docs » SendToOmniFocus

Handles "send current item to OmniFocus" for multiple applications

The following applications are supported: out of the box: Outlook, Evernote, Mail, Chrome and any Chrome-based apps (such as SSBs created by Epichrome)

Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SendToOmniFocus.spoon.zip

API Overview

API Documentation

Variables

actions
Signature SendToOmniFocus.actions
Type Variable
Description

Table containing application handlers for sending the current item to OmniFocus.

Notes
  • Each entry's key is the application name, and its value is another table with the following keys:
  • itemname - how to name the current item in the context of the application. Purely for cosmetic purposes in the notifications (e.g. in Mail, the notification says "filing message" instead of "filing item". Defaults to "item".
  • One of the following, invoked to do the actual filing:
    • as_scriptfile - path of a file containing AppleScript code. It will be executed using the osascript command. If quickentrydialog is set to false, the string nodialog will be passed as argument to the script.
    • as_script - string containing AppleScript code. There is no way to pass an argument to the script via this method.
    • fn - a function. It will be passed a boolean indicating the value of quickentrydialog.
    • apptype - a predefined "application type" to trigger different behavior for application families. The only valid value at the moment is "chromeapp", which can be used for any Chrome-based applications, including Google Chrome itself and, for example, any site-specific browsers generated using Epichrome.
  • The built-in handlers for Outlook, Evernote, Chrome and Mail are implemented by scripts bundled with the SendToOmniFocus spoon.
  • New handlers can be registered using SendToOmniFocus:registerApplication()
  • Default value:
  {
     ["Microsoft Outlook"] = {
        as_scriptfile = _resource_path("scripts/outlook-to-omnifocus.applescript"),
        itemname = "message"
     },
     Evernote = {
        as_scriptfile = _resource_path("scripts/evernote-to-omnifocus.applescript"),
        itemname = "note"
     },
     ["Google Chrome"] = {
        apptype = "chromeapp",
        itemname = "tab"
     },
     Mail = {
        as_scriptfile = _resource_path("scripts/mail-to-omnifocus.applescript"),
        itemname = "message"
     }
  }
Source Source/SendToOmniFocus.spoon/init.lua line 65
logger
Signature SendToOmniFocus.logger
Type Variable
Description

Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.

Source Source/SendToOmniFocus.spoon/init.lua line 50
notifications
Signature SendToOmniFocus.notifications
Type Variable
Description

Boolean to control Hammerspoon-generated notifications when filing items (doest not control AppleScript notifications, if any, generated from within the scripts). Defaults to true.

Source Source/SendToOmniFocus.spoon/init.lua line 55
quickentrydialog
Signature SendToOmniFocus.quickentrydialog
Type Variable
Description

Whether to display the new tasks in the OmniFocus quick-entry dialog before adding them. Defaults to true (set to false to send directly to the Inbox, without prompting)

Source Source/SendToOmniFocus.spoon/init.lua line 60

Methods

bindHotkeys
Signature SendToOmniFocus:bindHotkeys(mapping)
Type Method
Description

Binds hotkeys for SendToOmniFocus

Parameters
  • mapping - A table containing hotkey objifier/key details for the following items:
    • send_to_omnifocus - file current item to OmniFocus.
Returns
Source Source/SendToOmniFocus.spoon/init.lua line 201
registerApplication
Signature SendToOmniFocus:registerApplication(app, handlerSpec)
Type Method
Description

Register a new application handler

Parameters
  • app - application name
  • handlerSpec - a handler definition in the format of SendToOmniFocus.actions, or nil to unregister the application.
Returns
Source Source/SendToOmniFocus.spoon/init.lua line 190
sendCurrentItem
Signature SendToOmniFocus:sendCurrentItem()
Type Method
Description

Send current item in current application to OmniFocus by triggering the appropriate handler.

Parameters
  • None
Returns
  • The SendToOmniFocus object
Source Source/SendToOmniFocus.spoon/init.lua line 135