Omnifocus tagging

Hi there!

I am using the drafts action>email colleague>create omnifocus task. A lot.

The only thing I am stuck with is how to assign tags in omnifocus automatically?

Any help is appreciated :slight_smile:

Can you share your action(s)? They don’t look like original app ones or standard action steps, and from the names you’ve used, I can’t pick out what you might be using from the Actions Directory.

I suspect that with whatever you have in place, you might need to utilise the Taskpaper option for pasting a task with tags into Omnifocus. Have you looked at anything about that already?

If not, @RosemaryOrchard’s action group might help you along.

https://actions.getdrafts.com/g/1F6

Thank you for your response.

Currently I send the draft contents to my assistant via email, and then it runs this - omnifocus://x-callback-url/add?name=[[title]]&note=[[body]]

I have seen the other actions, but admit to not being a programmer! I was hoping to just be able to put some code into the above as they are static tags each time…

Thank you

Let’s see if this helps then.

I’ve started with a simple draft where as derived from your URL above, the draft title is taken to be the name of the task and the remaining content (the draft body) the notes for the task.

The next step I’ve taken is to use the Taskpaper (flavoured) transfer of data into OmniFocus. This utilises the paste URL scheme parameter as per the OmniFocus URL scheme reference, and the OmniFocus Taskpaper reference guide.

The x-callback URL I’ve put together looks like this:

omnifocus://x-callback-url/paste?target=inbox&content=-%20[[title]]%20@tags(Tools%20%3A%20Drafts,Device%20%3A%20Mac)%0A[[body]]

This example includes several things of note:

  1. I’ve explicitly set the task to be created in my inbox.
  2. I’ve pre URL encoded (ref Wikipedia) the spaces, colons and new lines. They are the three character codes beginning with percentage symbols.
  3. Note that the title is specifically being prefixed by a hyphen followed by a space. Refer back to the Taskpaper format details for why we need to do that.
  4. You said that your tags were static, so I have manually added two tags into my URL. These are for a couple of nested tags I have - Tools>Drafts and Device>Mac). You would modify the comma separated list of tags to suit your own needs.

The resulting x-callback action then looks like this.

When run, this then produces the following in my OmniFocus inbox.

Hopefully that should give you a reasonable walkthrough of what you would need to do to revise your own custom action to set your own tags.

That you so much! I am going to give that a shot!

I’m hoping that the addition of actions to the Mac version may allow saving of tags at my desk too.

Bill

If this URL based action works on iOS, I would expect it to work on Mac, too. I believe OmniFocus implements all the same URLs on both platforms.

Hi again guys, I have been trying to get this set up with various actions for delegations. Works perfectly when I just use your code, and therefore create those tags, but not when I try pasting in my own.

For example these are the tags I have for one person:

Person :tipping_hand_man:t3:> Gemma Kirkham :medical_symbol:

Would the images be a problem? Or spaces etc.

Thanks again!

If you can URL encode it, it should be fine (ref).

Look back at my earlier example.

Note the URL encoding %20%3a%20 is " : ", which is the separator for nested tags, and is incorporating spaces too.

Also remember that if you have a problem, you can try things out and analyse them. Try adding a test task with a root level tag that has no spaces or emoji. Then add the variances in individually to check compatability, or where you have an issue.

General note that Drafts template engine can also do that encoding for you if you wrap the parameter value to encode in {{ }}…or, using the new Define Template Tag action step to create a parameter for the URL, which can make things a little easier to read.

For @sylumer’s example, if you create a two step action, the first a "Define Template Tag with the tag name “content”, and the template:

- [[title]] @tags(Tools : Drafts,Device : Mac)
[[body]]

This create a new template you can use in the callback URL step after it, like:

omnifocus://x-callback-url/paste?target=inbox&content=[[content]]