Jack Baty Daily

Daily notes from Jack about everything

Weight logging with Tinderbox

Weight logging with Tinderbox

Note: This was originally posted over at copingmechanism.com but I thought it belonged here instead.

I kept a “daybook” using Tinderbox for years. I drifted away from Tinderbox for a while after becoming infatuated with Linux or iOS or other “cross-platform” systems. Right now, I’m back with a vengeance.

While rebuilding my Daybook, I wanted to make logging my weight easier. It’s not like it was difficult, but I wanted to tweak it.

Tinderbox is an outliner, so my weight entries are collected under a “Weight Log” node. It looked like this (I obviously wasn’t consistent with tracking last year).

The weight is stored in a numeric User Attribute called, surprisingly, “Weight”. The outline shows a custom “DisplayFormat” so that it reads nicely:

$Weight + " pounds on " + format($StartDate,"MM D")

To enter a new weight, I’d select an existing item in the outline, hit Return to create a new note, type in the weight, hit Return to save the note, then use the mouse to click the “Weight” attribute and re-enter the weight there. So much clicking!  😀.

What I wanted to do was to type the weight once in the note’s Name and have the Weight attribute populated automatically. Tinderbox notes can have “Rules” which are commands that run periodically and can update a note’s attributes based on just about any criteria. I could have created a rule that set the Weight based on the Name, but that seemed like overkill since this only ever needs to happen once per note.

With some help from Michael Becker, I think I’ve got it. (You should check out his video series on Mastering Tinderbox for all sorts of great Tinderbox content.)

There’s an OnAdd action which sets the Prototype, Date, and Name of the note. (Setting the Name of the new note to “Enter Weight” is a nice touch.)

$Prototype="pWeightLogEntry";$Date|=date(today);if($Name=="untitled"){$Name="Enter Weight"};

Then, the new note gets a Rule (via the pWeightLogEntry Prototype) which sets the Weight attribute based on the value of Name:

$Weight|=$Name;
if($Weight>0){
$Name=$Date("l");
$RuleDisabled=true};

The trick here is setting $RuleDisabled=true. What this does is force the Rule to run only once, which is all I need. I wasn’t aware of the $RuleDisabled attribute, so thanks to Michael for that tip.

Now, to add a new Weight Log entry, I hit Return, type my weight, and hit Return again. Couldn’t be any easier! On my Daybooks “Dashboard” I can graph my weight over time, like so…

For those of you unfamiliar with Tinderbox, I’m sorry if I made too many assumptions here. Explaining Tinderbox can be an entire job in itself!

✍️ Reply by email