Message Image to Family

Over the past several weeks, I’ve been cleaning up my older Pythonista scripts, TextExpander snippets, and Workflow macros.1 Some of this is in anticipation of iOS 12 and Shortcuts; some is to revive old scripts that don’t work in Pythonista 2/Python 3; and some is just because months of use has shown me that things could be done better. It’s probably time to start posting them.

Let’s start with the simplest one, a variation on a Messages workflow I wrote about last year. In this one, instead of quickly messaging URLs to my family, I message images to them.

It works like this: I take a photo or a screenshot that I want to send to some or all of my family. In the Photos app, I select the image, bring up the share sheet, tap Run Workflow, and choose Message Image to Family from the list of my action extension workflows. Up pops a list of my family, and I choose which ones to send the image to.

Choose from list

This choosing step could be skipped if I always wanted to send images to everyone in my family, but I don’t. Some go just to my wife, some to just my wife and daughter, some to just my sons, etc. The choosing step gives me flexibility.

After I tap Done, I’m switched to Messages, and the image is there in a new message in the proper thread, waiting for me to add text (if I want to) and hit the send button. The biggest advantage of sharing images this way is that I don’t have to hunt through Messages for the right thread.

The workflow itself is pretty simple:

Message Image to Family

The workflow starts by taking the image it’s invoked on and saving it to the variable TheImage. We’ll bring this back later.

The list of recipients is constructed from the Contacts action. When building the workflow, I added family members to the list one at a time by tapping the plus button and selecting them.

This short list of family members is the input to the Choose from List action, which is what lets me select who gets the message. Enabling the Select Multiple option is what gives this action so much flexibility. The set of chosen recipients is then saved in the TextRecipients variable.

Finally, we construct the message by referencing the TheImage variable saved at the top of the workflow and feeding it to the Send Message action. The action’s Recipients parameter is set to the TextRecipients variable.

This workflow is a little clumsy in that it doesn’t really “flow.” The image has to be taken out of the flow to get the list of recipients and then reinserted just before the Send Message action. It would be cleaner if the image could flow “around” the Contacts block directly into the Send Message action, but I don’t think the straight line paradigm of Workflow allows that.

  1. I will not call them “Workflow workflows.”