03/10/14 22:41:00

Private Journaling (Hazel, Day One, Twitter)

Some time ago I expressed on my public Twitter profile that I also have a private profile. I use this profile as a sort-of “quick diary”. The essential idea is really simple. I’m using Day One for journaling. The only problem is that sometimes I don’t want to pull out the “big” Day One app, just to jot down a basic thought that I had.

I find Twitter to be a really good way to do this quick journaling, because Twitter is so abundantly available. You can send a Tweet from basically everywhere. This makes it perfect as a journal! The only downside is that it’s not that easily possible to import the tweets into Day One. I still like to use my private account for this, though I wanted to extend on my original idea just a little bit.

My gut tells me Sven is going to like this.

Hazel and Day One

I’m using Federicco’s Send to Dropbox workflow to open attachments URL’s automatically on OS X. I thought that was a pretty clever idea, and my idea is based on that one.

Hazel monitors the folder for a mail to come in. It scans for the filename. If it contains the word “#journal” it triggers an action. The action itself is really simple. I wanted to be able to also attach photos, in case I send one along. Photos sent from the iOS Photos app always get the name “photo.JPG”, if it’s a photo, and “photo.PNG”, if it’s a screen shot. Checks whether there is also a photo somewhere with the text and pipes it to Day One’s CLI tool.

theFile=$(echo "$1")
journalentry=$(grep -v -e "Written with major efforts on an iPhone." -e "Written with major efforts on an iPad." "$theFile")

if [[ -e "$photo.JPG" ]]; then
    echo "JPG"
elif [[ -e "$photo.PNG" ]]; then
    echo "PNG"

if [[ -e "$photo" && -e "$theFile" ]]; then
    echo "$journalentry" | /usr/local/bin/dayone -p="$photo" new
    rm "$photo"
elif [[ ! -e "$photo" && -e "$theFile" ]]; then
    echo "$journalentry" | /usr/local/bin/dayone new 

Note the journalentry variable at the top of this script. The two grep commands filter out my email signature.