OmniFocus Actions Pack for Keyboard Maestro

Today I'm sharing my OmniFocus Actions Pack that I use daily. It works with OmniFocus 3. It offers the following actions:

  • OmniFocus Defer to Hour: sets the selected task's Defer Hour. If the defer date was in the past, set it to the next future occurence of the specified hour. If the defer date is in the future, only change the hour.
  • OmniFocus Deselect All Sidebar Elements: deselect all sidebar tree elements (if a tree is available).
  • OmniFocus Due on Hour: same behaviour as Defer to Hour, but for the due hour.
  • OmniFocus Get List of Selected Tasks: get the list of IDs of currently selected tasks.
  • OmniFocus Get Task File Path: if a file:// url exists in the note field of the first selected task, returns its POSIX path (may fail if special characters other than space %20 are present in the file path).
  • OmniFocus Get Task Mail Message ID: if a message:// url exists in the note field of the first selected task, returns its ID. Only works for links to Apple Mail messages.
  • OmniFocus Get Task Name: returns the name of the first selected task.
  • OmniFocus Get Task Note: returns the note of the first selected task.
  • OmniFocus Get Task Primary Tag Name: returns the primary tag name of the first selected task.
  • OmniFocus Get Task Project Code: returns the first word of the project name, assuming it is a project code.
  • OmniFocus Get Task Project Name: returns the name of the project of the first selected task.
  • OmniFocus Make Task: make a new OmniFocus task. You can specify its name, note, context and project.
  • OmniFocus Select Sidebar Element: select the sidebar element passed as argument. It can be a context or project, but it has to be valid for the current view.
  • OmniFocus Set Context: deprecated, it's better to use set Primary Tag instead.
  • OmniFocus Set Perspective: sets the perspective of the front window.
  • OmniFocus Set Primary Tag: sets the primary tag of the selected task.
  • OmniFocus Set Project: sets the project of the selected task.

Installation:

  • Uncompress the OmniFocusLibrary.scpt file, and copy it to ~/Library/Script Libraries/
  • Uncompress the Keyboard Maestro Actions, and copy them to ~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Actions/
  • Quit and relaunch Keyboard Maestro.
  • Optionally, you can install the Palette Demo Macros Library to help you start (double-click on the file, then select it in the macro library window and click on insert).

You can also call the procedures from the AppleScript OmniFocusLibrary directly.

I use these actions in a Macro Palette offering shortcuts for common things, like setting a context, a project or deferring a task to the afternoon. Using the Set Perspective, Deselect All Sidebar Elements and Select Sidebar Element actions, I can create a "smart" perspective, that will select tags based on the availability of an internet connection, my physical location, the Mac I'm currently using, the time of the day, or any other condition that you can define in Keyboard Maestro.

Palette%20Screenshot

OmniFocusLibrary.scpt.zip (472.3 KB) OmniFocus Actions Pack for Keyboard Maestro 2019-07-20.zip (5.6 MB)OmniFocus Palette Demo Macros.kmlibrary (177.3 KB)

5 Likes

I am not able to get this working as you outlined

Can you tell me a bit more about your problem? What have you done, and where exactly is it failing?

I did not have the folders in the path you listed and had to create and move the files.

I restarted KM and not able to find the script to run

MacOS - 10.14.5
KM - 8.2.4

The elements are in the right location. Now:

  • Create a new macro in Keyboard Maestro
  • Click on Add Action
  • You should be able to find the actions in Keyboard Maestro in the "Third Party Plugin" category (see screenshot). Note: you will see more third party actions in my screenshot, the action pack only includes the OmniFocus actions.

I have also added an OmniFocus Palette Demo Library in my original post to help you get started (see original post).

I must be doing something wrong, as I do not have the 3rd party smart folder like you do....

05%20PM

You're showing the list of existing macros. What you need to do is:

  • Create a new macro: click on the "+" button under the "Macros" column.

image

  • Give a name to your new macro.
  • Now, click on the "+" button under the new macro, or on the "New Action" button.

In the actions list that will pop-up on the left of your new macro, you should have the Third Party plugin category. You may need to scroll up to see it.

THANK YOU! I am new to KM and this helps so much!!!!

Kornichon,

Many thanks for your pack.
I have been researching different todo type applications that I can interact with Mail.
Being able to use message IDs and scripting was important to ease the interactions between the 2 programs.
Your pack gave me the incredible start I needed to move forward.

You have some other macros shown above regarding mail.
Would you be able to share them also?
Anything to help bridge the 2 apps together would be great.

Thanks,
Brett