Tech help beeminding OmniFocus

My life would be a lot better if I could beemind tasks like cleaning my OmniFocus inbox, completing my scheduled reviews and not letting tasks go overdue. For a little over a year I’ve been saying to myself that if I had Beeminder for this, I would stay on top of it a lot better. So now I’m finally going to do something about it, but I need some help.

I’m a pretty experienced software developer, but I have no experience with web platforms or cloud computing. I can see all of the pieces that I need to make OF talk to Beeminder, but I can’t quite see how they fit together. OF keeps its data in an XML file that is pretty straightforward to parse. I can access this file either through a) Omni’s WebDAV interface or b) DropBox. I can write an application server in Ruby/Java/whatever that reads the XML file and presents it as a REST API. Once I have the REST API I can point Zapier or IFTTTT at that and then I’m at the finish line.

My main stumbling block is how I host the application server so that anyone can use it. In order to let another user access their OF data, it seems like my application would need their credentials, which maybe they are not crazy about.

So if anybody could comment on my general approach and any thoughts about my stumbling block, I’d be grateful.

3 Likes

Step one is to try it out manually before you go down an implementation rabbit hole.

I’ve successfully beeminded my weekly and monthly reviews for years. None of them tied automatically to my systems. (Though the narrative reviews are updated via Zapier noticing that I’ve added a text file to a directory.) We beemind the Beeminder support queue manually, too, by getting a point every time that we hit zero. And like most things, I wouldn’t have done nearly as much without beeminding it.

Saying “manual first” is not a vote against automation, of course. But don’t let your dreams of it being slick and integrated stand in the way of creating a relevant Beeminder goal today.

Also, I usually find that my intuition about what to automate is flawed in the absence of using it in practice. So many automations left by the wayside, fun though they were to build. I’m getting better at live prototyping with manual data entry and letting the pain of that prioritise what needs to be automated and how.

4 Likes

OK fair point, I’ve started two Beeminder goals to track zero inbox and reviews. I’m still planning to start on this project now though, because it’s both interesting and useful. If anyone has some hints/implementation ideas I would love to hear them.

2 Likes

Just wanted to chime in that having people doing creative stuff like this with the Beeminder API is hugely valuable for us. So please don’t be shy about asking questions or voicing even minor frustrations with our documentation or anything. Excited to see what you come up with!

I don’t know what OF provides in terms of authentication options, but if possible, I’d recommend putting off the authentication / hosting as an app / making available to others as a secondary concern to getting your own data hooked up. Implementing OAuth flows tends to be kind of fiddly and annoying in my experience, and so if starting by putting your own login&pw in a config file gets it working easier/sooner, then you can test the actual meat of the project, and like @philip said, actually discover if it’s a good idea to Beemind etc :slight_smile:

And I second @dreev that bugging us about API stuff is not in fact bugging – leads to better documentation etc!

4 Likes

Turns out that OmniFocus Pro has AppleScript support. I just wrote this to auto-mind the size of my inbox using Hazel and the bmndr commandline script.

#!/bin/bash

# this sends your OmniFocus inbox count to Beeminder
# requires: OmniFocus Pro, lydgate's bmndr script
# optional: hazel or cron scheduling

BMNDR=bmndr
GOAL_SLUG=omnifocus

COUNT_FILE=OmniFocus.count
if [ ! -f $COUNT_FILE ] ; then
  echo -n 0 > $COUNT_FILE
fi

# make the file 'today' be 'midnight'
/usr/bin/touch -t $(/bin/date +%m%d0000) today

INBOX_COUNT=$(/usr/bin/osascript -e '
  tell front document of application "OmniFocus"
  set theTasks to every inbox task whose blocked is false and completed is false
  set theCount to count of theTasks
  end tell
  return theCount
')

# if the count has changed, or not been sent yet today
if [ $INBOX_COUNT -ne $(cat $COUNT_FILE) -o today -nt $COUNT_FILE ] ; then
  $BMNDR $GOAL_SLUG $INBOX_COUNT OmniFocus inbox count at $(/bin/date +%H:%M)
  echo -n $INBOX_COUNT > $COUNT_FILE
fi

UPDATE: now sends a datapoint if the day has changed, as well as if the count has changed. Also, I no longer watch the particular file, but have set up a more general cron-like folder using Hazel, but that seems a step too far for this forum!

3 Likes

Hey @philip,

Do you think it would be easy to change this so that it’s sending the “overdue” count to Beeminder instead?

I haven’t put the above together yet (though I’m going to) because I don’t actually know what Hazel is, so I need to google that first, but I thought I’d like to do it that way when I do this, if that’s possible.

My AppleScript was a bit trial and error, with plenty of help from the internets and sample scripts from other OmniFocus users. Obviously it’s this line that would have to change, but I couldn’t tell you how exactly:

set theTasks to every inbox task whose blocked is false and completed is false

Hazel is an awesome Mac utility that can run rules on files and folders, triggered when they get created or change. I’ve just used it here to create a pseudo-cron-job, any method of run-this-script-regularly would do the trick.


Philosophically, I wonder at the meaning of sending an overdue count to Beeminder. It suggests to me that either you’d be lying to OmniFocus about the due date, or planning to fail to meet your commitments, or something equally slippery. Strikes me as dangerous psychological precedent.

It may be just as easy to get a ‘due-soon-and-overdue’ count from OmniFocus, which seems more compatible with the notion of doing things before rather than after the date.

1 Like

I think the overdue count is useful - I was hoping to add a ‘do less’ goal
to prevent me from letting things get overdue. If my overdue count is
greater than zero it means I either lied to myself about the due date or I
really didn’t do something that I should have. In both cases I’d like
Beeminder to sting me (more the former than the latter, since it should
have its own sting)

That’s kind of my thinking too. But if your Beeminder goal only goes eep! the day after something was due, then we akratics are likely to treat that as the real deadline.

That’s why I think I’d prefer a setting that checked for due items rather than overdue items; today is the day to do it without penalty.

Either way, watch out for the interaction between the due-date-time in OmniFocus and the goal’s deadline time. You don’t want something to pop onto the bee-radar just before bed and derail you.

Related: various folks have asked about beeminding random input, i.e. giving yourself 24h after a trigger event to deal with it. There’s no great solution for that currently.

1 Like

I think you’re right. At the moment, though I’m trying to Beemind the reduction of a backlog (as well as the lessening of the tendency to let things get overdue). Then I figured I could change the criteria, but keep the same graph (with good commenting to make it easy to pull the data apart later).

I wonder if your script could be tweaked for OmniPlan as well. That would be about 40 times more valuable for me (and the OmniFocus one is already plenty valuable!), but I don’t have time to try to work it out this week. After that, though I might see if I can piggyback off of what you’ve done and change it enough to make both work exactly the way I want them to. Thanks for sharing this.

1 Like

Ooh, I should try OmniPlan again. It was always overkill for my old life, but might make sense in the new world. Let us know how you get on.

1 Like

Yeah I love OmniPlan, but it’s hard to keep track of how much I’m getting done with it. In fact, I can’t really find a good system for Beeminding to-dos. I’ve tried a lot of things, but they all require so much tracking time that the friction is too high to be worth it.

By the way, what’s “muflax’s bmndr script”?

1 Like

It’s a defunct integration between Anki desktop and Beeminder. You can find forks of it still on GitHub, as discussed here.

But that’s not what I meant to write in the comment! (fixed now, thanks)

Should have been lydgate’s bmndr script, a python command-line interface for submitting data points. Or my fork of it, or any other way of submitting datapoints via script, of course.

1 Like

Thanks @philip. I’m looking forward to working on getting this set up. I need some kind of connection to my to do list so that i make sure those tasks keep moving!

Great discussion. How did you end up with connecting OmniFocus with Beeminder?

@bcool : my setup hasn’t changed much since I described it above

I’ve subsequently changed my goal’s deadline to noon, and tweaked the script to match. But it’s still that same chunk of AppleScript doing the work of interacting with OmniFocus.

My use of OmniFocus has changed, I now use it mostly as a tickler file to add deferred tasks to my working list, and as a master list for doing (so-called) weekly reviews.

2 Likes

@philip
I’ve put together a script to mind my overdue hours on OmniPlan projects. Do you know how to select a particular file with applescript? I suspect that’s something you didn’t have to do for the OmniFocus script, but I thought I’d ask just in case you knew and it was easily translatable for OmniPlan, cause I’m just using the front document, which definitely isn’t as convenient, and my attempts at figuring out how to specify project files have been thwarted!

1 Like

Hi MCM!

No idea, sorry. All of my Omni AppleScript knowledge came from searching for examples and experimenting with fragments until it seemed to do what I wanted. I can’t claim to have penetrated any Mystery…

Worth saying in case you don’t know, that there’s an OmniGroup Forum that may have samples or answers.

1 Like

I’m just going the easy way and using
open “/Users/…/filename.oplx”
delay 5
tell front document of application “OmniPlan”
[the things I want it to do go here]

and then closing it before doing it again with another project. Easier than figuring it out and works just as well. I’ve basically got a script now that can open each of my OmniPlan projects, get the hours of overdue tasks (by summing the “effort” for each overdue task) and then sending it vie emails to each “keep under some number” goal that encourages me to slowly chip away at any backlog while keeping up with tasks that are coming due.

2 Likes