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.
- 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.
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)