Applications are made more powerful with URL schemes. URL schemes are links that launch an application or kickstart extra functionality. Sometimes even for automating common tasks. In OmniFocus they do a few things: launch directly into a particular view, like Forecast, or add new Stuff from other applications. OmniFocus’s URL Scheme got a major update in April, 2016, with OmniFocus for iOS 2.14. On the Mac, OmniFocus 2.10—launched in June, 2017—includes most of the same functionality.
Automating Task Creation in OmniFocus
There are several ways to add actions to your database—we talk about a few of them on our 3rd party app page specifically about iOS—but a lot more is now possible.
Let’s start with this simple URL:
omnifocus:///add?name=Pick%20up%20milk¬e=You%20gotta
We’ve added a basic action to OmniFocus by using these variables:
name
(your action’s name)note
(an optional note)
That link will work anywhere OmniFocus is installed. The app will launch from Safari, Mail, or any app capable of opening a URL. But a lot more can be done with parameters recently in OmniFocus for iOS 2.14 and OmniFocus for Mac 2.10.
New parameters for the add
action:
attachment
(base64 encoded)attachment-name
(repeated if necessary for multiple files)parallel
(true or false)flag
(true or false)defer
(date and time, likejun 25 8am
)due
(date and time, likejun 25 8am
)project
(case-insensitive match)context
(case-insensitive match)autocomplete
(true or false; do children mark project complete?)estimate
(30m for 30 minutes)reveal-new-item
(true or false)repeat-rule
(see here for format information)repeat-method
(fixed, start-after-completion, or due-after-completion)completed
(date and time, likejun 25 6pm
)
You can string these parameters together using &
as a separator. Spaces and other special characters might need percent-encoding.
Launching directly into Perspectives
Take this scenario:
Each day, Amanda starts a quick review. It helps her prepare for the urgent and hope-to-do tasks. The bulk of this review occurs with the help of an OmniOutliner document on her iPad Pro. In the Outliner document are specific tasks to perform: some in Mail, OmniFocus, and elsewhere.
The Outliner document is a checklist for the daily review but, additionally, also a launchpad. This is where Amanda quickly jumps around by using the URL scheme: she gains focus and saves time by jumping right where she needs to go.
So Amanda stores a few of these URLS in her OmniOutliner document:
omnifocus:///inbox
omnifocus:///flagged
omnifocus:///projects
omnifocus:///tags
For Pro users, custom perspectives work as well. Instead of placing the custom perspective’s title right after omnifocus:///
, use perspective/Bills
or perspective/Homework
.
omnifocus:///perspective/Bills
Handling spaces: make sure you’ve added the HTML entity %20
as a substition for each space!
omnifocus:///perspective/Bills%20and%20stuff
Launching to Forecast: Past, Today, Soon
You also have direct access to Forecast cells:
omnifocus:///past
omnifocus:///today
*
omnifocus:///soon
(Note: the above three URLs work only on iOS.)
If you don’t need specificity, use omnifocus:///forecast
. (This one works on both Mac and iOS.)
*A note on the omnifocus:///today
link: if the Today setting has been changed in OmniFocus Settings, you’ll head there!
x-callback-url Support
If you’re using an app that supports x-callback-url
(Workflow, for example) the callback will include a link back to the created task or parent project.
For example, the following URL:
omnifocus://x-callback-url/add?name=My%20shiny%20new%20%20task&autosave=true&x-success=[source-app]:///
…calls back to the app called source-app
with ?result=omnifocus:///task/mbp0SlWkvqq
. That URL is a direct link to “My shiny new task”
TaskPaper-Formatted text
In addition to the add
action, OmniFocus now supports the TaskPaper format for action interchange. TaskPaper-formatted text can be added to OmniFocus by pasting directly into an outline or by using the URL scheme’s /paste
action. To pull OmniFocus data in the Taskpaper format, select Copy from the Share Sheet on iOS or choose Edit ‣ Copy as TaskPaper on Mac.
Copy TaskPaper-formatted text from any other app, paste it where you’d like it in OmniFocus, and bam—you’ve got all of your data. Ken, our CEO, put together this Editorial workflow that takes the currently-selected text in Editorial (with placeholders for template-specific data) and shuttles it over to OmniFocus, perfectly formatted.
Paste has a few extra parameters that can direct the data to a specific spot:
target
(can beinbox
orprojects
for top-level items; usetarget=/task/task-id
(for a specific action),target=/task/project-name
(for a specific project), ortarget=/folder/folder-name
(for a specific folder))index
(positive integers count forward from beginning, while negative numbers count back from the end of list)content
(TaskPaper string, the content to paste; without this parameter, OmniFocus captures text from the system clipboard)
If simply activating omnifocus:///paste
without any of the above, the clipboard will be parsed and added to your Inbox.
For the most part, OmniFocus lines up with TaskPaper tags. The full gamut of tags that can be used are discussed in this forum thread near the end.
Adding attachments
When adding attachments to new actions, they need to be encoded in Base64. This is easy with Workflow. This shared Workflow takes a file, encodes it, and then sends it over to OmniFocus.
It’s a great way to file a PDF away for review from Mail.