Categories
Automation Health Tech

Diet success with Due App, shortcuts and app launching

Here’s one truth about how I lose weight: nothing is as effective as simply writing down what I eat.

If I track everything I eat in a calorie tracking app (I use one called Track, but there are a bunch of similar apps), I eat less. Maybe seeing what I’m eating makes me more conservative in my snacking or maybe I don’t want to take the time to log that handful of M&Ms so I skip them. Either way, I’ve lost about 15 pounds during this quarantine, all by simply tracking my calories. 

The thing is that I usually stop logging what I eat after a few weeks. Logging what I eat is a nuisance. I regularly forget to open my calorie tracking application right after I eat and by the time I finally get around to it as I’m sitting down to watch a show before bed, I’ve largely forgotten what I’ve eaten throughout the day.

So what makes this time different?

Well, for starters, I’ve been using the Due application on my iPhone to remind me to enter my calories after breakfast, lunch and dinner each day. Due is a persistent reminder application. Meaning, it just keeps annoying you with reminders until you actually do the damn thing it’s reminding you to do. 

Still, after a couple of weeks of using Due, I started just clicking “done” on the reminder because clicking through the reminder and opening my calorie tracker application just seemed like a pain in the ass and was too much friction. So, I solved that friction point by adding a link in the reminder that opens my calorie tracker in one click. 

In other words, tracking what I’m eating has been working for me because I chained together three different, loosely-coupled technologies here:

  • a decent calorie tracking app that makes a tedious task as easy as possible – Track
  • a persistent, annoying reminder application to remind me to log my calories – Due
  • a link in the reminder to make it super-easy, low-friction to open my calorie tracking application right from the reminder. – iOS shortcut

Some apps support a URL Scheme to open the application (for example, music:// opens the Music application). The Track application doesn’t, AFAIK, have URL Scheme support so instead I just created an iOS shortcut to open the application and I call that shortcut in the reminder like this

IMG 9A9E4424A017 1

So, when the alert pops up on my phone, I just click the red link and Track opens up. Nifty.

But, this Reminder + Link to Application has also been helpful for the Day One #photoaday challenge for the month of September. Every day at mid-morning I get an alert to post a photo from today to Day One with a link to the application that opens Day One and creates a new post:

IMG 1D868C3ACF03 1

Here you’ll see that Day One support the URL Scheme directly so there’s no need for me to create an iOS shortcut, I can just call the new post URL and it works (though, why it doesn’t show up in red in Due is beyond me).  You can do a whole bunch of cool things with the Day One URL Scheme, like go right to the activity feed: dayone://activity  or create an entry with a clipboard image dayone://post?entry=Hello Self&imageClipboard=1. See this list if you want more ideas.

Categories
Automation Music

Zoom volume and Music Volume control with Keyboard Maestro

My new favorite Keyboard Maestro shortcut allows me to toggle between audio outputs (Built In Output device and my USB output). The Built in volume controls my iMac speakers, the USB output controls my Amp. So, combined with the superb Rogue Amoeba’s SoundSource, I can easily bounce back and forth between controlling my music volume (Roon, Spotify, archive.org) and my Zoom volume using my keyboards volume controls. This sounds like it would be easy and it is, sort of, by using switchaudiosource-osx (available as brew install switchaudio-osx from command line). 

Anyway, this is a huge problem solver for me. Stoked. Click pic below for larger version if you want to see the actions.

 

UntitledImage

Categories
Automation Post

Log/Append a photo to a Day One entry

Someone posted a question about how to do this on the Day One Community site so I thought I’d build up a little iOS shortcut that:

– checks to see if you have an entry for today, if not it creates a blank one and then prompts you to choose a photo, resizes that photo and then appends the photo to today’s journal entry.

Here’s the shortcut, you’ll need to choose which journal to use and how large you want the inserted photo to be.

Categories
Automation Tech

Logging throughout the day with Day One and iOS shortcuts

Spending some time on the Day One community page on Facebook it seems like for those who journal multiple times per day–adding notes, thoughts, activities throughout the day–there are two schools of thought for capturing throughout the day:

1.) create a new entry in Day One for each of the day’s multiple entries
2.) append to a single daily entry throughout the day.

I fall firmly into the second camp, using markdown bullets and a time stamp to log entries to a single entry throughout the day.

Unfortunately, for all of Day One’s strengths and features it does not make it especially easy to automate the process of appending thoughts/notes to a single day’s entry throughout the day.

In the past, I might have relied on a bit of AppleScript or Keyboard Maestro to solve this problem. But now, my time is split evenly between sitting behind my Mac and using my iPad.

Apple is making it harder and harder to write one-size-fits-all automations that can be used on the Mac and on the iPad and iPhone. Automation is now platform specific: shortcuts on iOS and some combination of automator, AppleScript, keyboard maestro, Alfred, etc. on the Mac.

But whether I’m in front of my Mac or my iPad, I always have my iPhone with me. And while it’s not the best device for capture, I decided to focus my “capture and append” automation efforts on the iPhone rather than string together a bunch of hacks on my Mac.

I wrote an iOS shortcut I wrote does the following:

  • checks to see if a Day One entry exists for today
  • if one doesn’t exist it prompts you to create either:
    • a blank entry
    • an entry using a few prompt questions
  • prompts for log entry
  • asks if you want to put time with the log entry
  • appends the time/log entry to the end of today’s journal entry

If you are going to use this shortcut you must expand the six “Day One” actions in the shortcut and change the “Journal” field to match the name of the journal you’re using in Day One.

You may also want to edit the questions in the “A new entry from prompts” section. Just make sure to split them up with a line break.

Once you make those changes, it should just work for you.

The big caveat here is that if you use Day One on both iPad and iPhone, this shortcut seems to only work on one device. It works great on my iPhone. But if I try to use it on my iPad and I haven’t yet opened Day One on my iPad the shortcut doesn’t realize that I’ve already created an entry for today on my iPhone.

This seems to be related to background syncing of the journal contents. The solution is just use it on one iOS device OR make sure you open up Day One and that it syncs before running it on that other device. That being said, even when I do run it on the iPad, the appended line doesn’t show up on the entry, which is weird because if I view the entry on my iPhone, it’s there.

Again, syncing seems to be the issue here. Day One support has been helpful (as always) in helping me troubleshoot this but it seems like iPadOS background syncing is just flakey right now.

Here’s a link to the shortcut. Ok, happy logging!

Note/Update: the shortcut now copies the entry to your clipboard. Occasionally it seems like the shortcut doesn’t actually append the log entry as expected. I don’t know why. Restarting my iPhone seemed to solve the problem so probably syncing related but in any case, by copying the entry to your clipboard if for some reason the log note doesn’t appear when the entry is opened, you can always just paste it in from the clipboard. Lame, I know. I wish shortcuts were more reliable.

Categories
Automation

AppleScript for Day One braindump to Things

Highlighting the truly first-world problem of Mac automation being totally different from iOS automation, I wrote up a simple AppleScript that mirrors the functionality of my iOS shortcut that takes my brain dump list out of Day One and “intelligently” transfers it to Things.

When I write my morning entry in my Day One journal I sometimes brainstorm a little todo list, and this allows me to copy it and load the todo list into Things. Moreover, it looks for the string “today” in the brain dump and puts those items in the Today list in things.

set TodayStr to "today"
set Total to 0
set listContents to get the clipboard
set delimitedList to paragraphs of listContents


tell application "Things3"
	repeat with currentTodo in delimitedList
		if currentTodo as string is not equal to "" then
			set Total to Total + 1
			if currentTodo contains TodayStr then
				set newToDo to make new to do ¬
					with properties {name:currentTodo, due date:current date} ¬
					at beginning of list "Today"
							else
				set newToDo to make new to do ¬
					with properties {name:currentTodo} ¬
												end if
		end if
			end repeat
		end tell

set theDialogText to "Added " & Total & " Todo Items to Things"
display dialog theDialogText

I mapped this in Alfred to ⌘T so that when I’m in Day One and finish brainstorming what I need to tackle, I can just highlight the list and hit ⌘T and the list is moved to Things. Not brain surgery but really useful for me.

Still though it does feel weird to have to automate using AppleScript on the Mac and Shortcuts on iOS.

Especially now that the automating functionality offered by apps like Day One differs depending on whether you are on a Mac or on iOS. Looking at you Append function that’s available on iOS.

Categories
Automation

Amazon Order History to Markdown table in Day One

Back in the spring I wrote an automator action that incorporated some Python code to take a downloaded Amazon Order History file and massage it into a nice Markdown table and creates a Day One entry.

A few months back though the Day One command line tool stopped working and that broke this action. But surprise!!! The command line tool works again (although not as well as it used to). So I modified the automator action to get it working again. 

So, pop this workflow in your ~/Library/Services folder and you can just right click on the downloaded Amazon order history file to create a Day One entry from the purchases. 

Screen Shot 2020 01 08 at 7 59 24 AM

 

This is what the Markdown table looks like as a Day One entry (atypically expensive month, FWIW 🙂

Screen Shot 2020 01 08 at 8 02 20 AM

Categories
Automation Post Tech

Adding todos to Today list in Things using AppleScript

Really pulled my hair out for a while on this issue so hoping to help someone out here.

set newToDo to make new to do ¬
		with properties {name:CurrentTodo} at beginning of list "Today"

This, despite the Cultured Code documentation using Today as an example list in the AppleScript guide.

So, if you use that code and replace “Today” with “Someday” it works like a champ but if you pass it the list “Today” the todo item is created in the Inbox and not the Today area of Things. Weird and it was making me crazy.

Anyway, the easy solution is:

set newToDo to make new to do ¬
		with properties {name:CurrentTodo, due date:current date}