Tag: drafts

Quick Tracking for Quantified Self

This one is nerdy, even for me. Consider yourself warned.

I wanted to start tracking some data points. I was using FitBit for step and weight tracking, MyFitnessPal to track calories, and mood and environment using Reporter. But there were other things. What time does my daughter’s bus arrive in the morning? How often did I use my rescue inhaler? Neither were things where I needed to provide any more input beyond “event happened”. I’m slowly consolidating my data into a Google Docs spreadsheet, and so I decided these two could go in there as well. The spreadsheet has columns for time, type of record (event, weight, location, etc), a description, and latitude and longitude. 

Bus Arrivals

First up was the bus arrival. While my daughter gets on the bus, I tap an action in Launch Center Pro. That action hits the following URL:


Basically, it tells Drafts to create a draft of “event ||| bus arrival” and call the ifttt action in Drafts, then hand control back to Launch Center Pro. 

The ifttt action in Drafts looks like this:

drafts://x-callback-url/create?text={{!ifttt}}%0A[[draft]]&action={{List in Reminders}}&afterSuccess=Delete

This takes the text of the draft and dumps it into Reminders in the ifttt list. Once it’s done, it deletes the draft, so things stay tidy. 

Finally, I have an IFTTT recipe that takes items in the ifttt list in Reminders, and adds them to my lifelog Google spreadsheet, prepended by the creation date. That recipe can be found at https://ifttt.com/recipes/160434-lifelog-text-via-reminders

Rescue Inhaler

For this, I thought I’d add a location aspect, because while the bus always stops in nearly the same place, I might need my inhaler anywhere. If I see a pattern, maybe I should avoid those places. So, I inserted Pythonista into the equation to get the location data. First up, the Lauch Center Pro Action:


This calls the Pythonista script ifttt.py with the argument “rescue inhaler”. I won’t pretend it’s a good script, but it works. I borrowed a lot of it liberally and if someone recognizes their code here, please let me know so I can give credit for it. Any issues in it are my doing. 


import console
import clipboard
import sys
import webbrowser
import urllib
def getLocation():
import location
import datetime
import time
“Returns current location and timestamp in readable format”
rating = sys.argv[1]
current = location.get_location()
address = ‘event|||’ + rating + ‘|||’ +  repr(current[‘latitude’]) + “|||” + repr(current[‘longitude’])
loctime =  address 
return loctime
# clipboard.set(getLocation())
draftUrl = getLocation()
draftUrl = “drafts://x-callback-url/create?text=” + draftUrl + “&action=ifttt&x-success=launchpro://”

It takes the incoming argument (“rescue inhaler”), gets the latitude and longitude where the phone is now, and mashes it all together with a triple pipe separating them. (The triple pipe is how IFTTT knows how to separate the columns on text headed to Google Spreadsheets.) It then calls the ifttt Drafts action noted above, and the process goes out as described before.

The new Grocery List process

So now that I’m not using my Applescript and Numbers grocery list, how am I doing it? 

Two key pieces – Drafts for content entry and Evernote for storage. I created a notebook in Evernote specifically for lists.

In Drafts I have tow actions defined. One adds the current note to a predefined groceries note in Evernote. But there’s lots of time where I need to add items to a non-grocery list, like Target,  home improvement or pet stuff. So I have a separate action which reads the first line of the note as the notebook and adds the rest of the note to that list.

Because I’m a packrat, I also keep the old lists around. Once I’m done at the store, I rename that list by appending the date to it. (And if Evernote would support TextExpander, that’d be even easier — hint hint). 

Catching up.

Guess I should follow up with where I am with the projects from previous posts.

Grocery lists (here and here): I’ve stopped adding them to the Numbers spreadsheet. Took too long and had some fragility issues around the script that processed the data on the Mac. Instead, I use Drafts to post things to the list in Evernote.

Date recognition (here): Became a moot point when Hazel added a better implementation to its rules.

As for task management, I’m using a variation on The Secret Weapon which probably needs some more revision. (Future post, I’m sure.) At the time, I liked the idea of using Evernote and was headed towards it being Where I Lived. I still use it a lot, but I don’t live there. More of a vacation home, really.