Recording the weather in Tinderbox
Each day I create a note called “Doing” in my Tinderbox daybook. This note is a dumping ground for little things I want to record during the day. I wanted to include the day’s weather, just for fun. Here’s how I did it.
First I had to find a way to grab the weather via command line. Turns out that Weather Underground has a nice API and Stephen Ramsay has created a little command-line application (written in Go) called wu https://github.com/sramsay/wu
Once wu was installed I needed a way to call it and get the results into my Tinderbox “Doing” note. I used a Stamp for this. The Stamp uses Tinderbox’s “runCommand()” command to shell out to the terminal and run wu. It looks something like this…
The simplest Stamp would have been this…
$Text=$Text+runCommand("/Users/jbaty/go/bin/wu")
…but I fancied it up a little. The actual action text I ended up with was this…
$Text=$Text+"rr---- Weather: ------------------------------------------------rr" +
runCommand("/Users/jbaty/go/bin/wu")
So to get the weather, I select “Doing” and choose “Get Weather” from the Stamps menu. The weather is then magically appended to whatever text is in the selected Note. Like this…
That was easy.