Shortcuts

Apple's Shortcuts app is a really powerful automation system. I use several. I thought a few of these might be either useful to folks either to use directly, or as examples of what to do with Shortcuts.

Cow I Win!

I play an absurd game with several of my friends involving spotting cows. In some ways, it's similar to a lot of driving games I've seen in many families: whoever sees a cow and shouts "cow I win!" first wins for the day. The main twist to this one is that you are always playing with anyone you have ever played with. So I will occasionally get texts from friends in different states — or countries! — declaring they've won the cow game.

To automate declaring victory, I have a shortcut, just called 🐄, which presents a menu of folks I've played with before, waits for me to declare which ones I'd like to declare my victory to, then sends a triumphant "Cow I win!" to each. I use the menu to avoid texting people in different timezones at unkind hours (the rules of the game require you to say the phrase out loud, but do not require anyone hear it when you do). The shortcut uses "repeat from each", rather than sending to the list, because while I've played the game with each of these people, not all of them have played with each other (or know each other at all). I have configured a "Siri Phrase" of "Cow I win", so I can just tell Siri about my victory and send all these messages with one tap.

Get your own cows: 🐄.

Blogging and micro-blogging

I've got a a pair of shortcuts that let me send text to my (weird) blog and twtxt file. The one for the twtxt file isn't even worth sharing: it just takes the input and passes it to "Run scrpt over ssh", which in turn contacts my server and runs my "tw/w", part of my twtxt client.

The second is a little more interesting, although mostly by accident since my "blog" is a bunch of statc files orchestrated with 'mk'. It takes the input and, after asking for a file name, passes it to an ssh script which writes out the content to the correct place and runs 'mk' to update everything. The blog system can handle a variety of source types, but I mostly end up writing in markdown, so the filename defaults to YYYY-MM-DD.md. But if i want to send up a troff man page instead, I can just change the name when prompted and all will be well.
This isn't terribly useful on its own until I finally get around to cleaning up and publishing my mkfile and soome notes, but the shortcut itself might be a useful example of doing things with Shortcuts' ssh capability; there's basically nothing specific to the blog system in it other than the fact that it opens a URL at the end.

Care and Feeding

I've got a few shortcuts my partner and I use for tracking the care and feeding of our infant. They write to a note with "care and feeding" in the title. We made a shared Note for this, although the shortcuts don't know or care that it's shared. It does, however, allow us to each log what we're doing separately and still have everything show up in one place. I describe the first three I made below; we've since added "Tylenol" and "Motrin" shortcuts which are essentially the same as the first two described below with the obvious substitutions.

The first two, Wet Diaper and Dirty Diaper, just write a timestamp, "dirty —" and 💦 or 💩, respectively.

The final one, Feeding, is a slightly more interesting example. We want to be able to track how much we're feeding, and what type of feed (breast, breast milk from a bottle, or formula). First, it asks for a number of milliliters fed. We don't have a good way of tracking ml by breast, so we sort of punt on that, and just say 0. The shortcut prompts for a number of ml, and if we enter 0, it assumes that's a breast feed. If you give a number, it'll then ask whether that's milk or formula. Then it writes "feeding —", the count of ml (or 0ml), and either "breast", "milk", or "formula".

One interesting thing I learned with my partner and I writing to the same note: even within the same locale, the date/time formats under the "Current Date" variable for Text boxes depend on local device settings. So lines entered by my partner get, for example, "6:02 PM", whereas if I'd entered it, it'd read "18:01". I'm not currently parsing these lines in any way, but something to be aware of.