Workflow is a powerful iOS automation app that I’ve been exploring over the last two tutorials. It doesn’t have as much control over your system as macOS automation apps like Keyboard Maestro or BetterTouchTool but it can still do a lot.
Automating the iPhone With Workflow III
With Workflow, you string together series of actions from different apps. Dozens of different apps—from OmniFocus to Facebook—can be used through Workflow.
In the first tutorial in the series, I looked at the very basics of using Workflow. In the second tutorial, I explored using variables in workflows. You should read both of these tutorials in full before continuing. You’ll also need a copy of Workflow, which you can get for £2.99/$2.99 from the iOS App Store, to follow along.
In this tutorial, I’ll take a deeper dive into variables and also look at accepting user input and using control flow techniques in a workflow.
Control Flow Explained
In programming, control flow techniques are things like if-else and for loops. They let you dictate one series of actions that will be performed if one thing happens and an alternate set of actions that will be performed if a different thing happens. They’re one of the most important foundations of programming and, by extension, automation apps.
In this tutorial, I’ll be soliciting input from the user (that’d be you and me) and then, depending on what response they give, executing a different series of actions.
What I’m Building
This workflow is a little more complicated than the ones built in the previous two tutorials so before digging in, Let me set out what I aim to accomplish.
At the moment, I’ve got a small group of three friends I regularly meet up with for a drink or a coffee; I’ll call them Tom, Dick, and Harvey. There’s four different venues we regularly go to. It’s awkward to text them each individually to arrange fairly predictable plans for the evening so we’re going to build a workflow that automates it.
What it’s going to do is give us a choice of the four venues my friends and I normally visit, then, depending on which one we pick, it will text Tom, Dick and Harvey and ask them if they want to join.
Although this is a semi-real world use case, I’m building this workflow more as an example as to how you can use control flow techniques in your workflows. Feel free to modify things however you want as you follow along.
Building the Workflow
Create a new Normal workflow and call it something like Evening plans.
The first thing I’ll do is add a variable called venue. In the last tutorial I relied on Workflow’s Magic Variables but this time I’m going to do it myself.
From the Scripting actions, grab a Set Variable action. Set the value of Variable to Venue.
Next, from the Scripting actions, add a Choose from Menu action.
This will cause a menu to pop up from where I can pick the venue. I want to list the four bars we normally go to: Crewzer, Scandi, O’Connells and Snesko.
Adding each of these prompts will create a new control flow option. If I select Crewzer, all the actions under Crewzer will run. If I select Scandi, then all those actions will run instead. I’ll add those options.
I’ll start with Crewzer. From the Text actions, select Text and add it underneath Crewzer.
Add the word Crewzer to the Text box and underneath, from the Scripting actions, add a Add to Variable action. Put in Venue for the Variable Name
Next, repeat the last step for all the other venues. Add a Text action with the venue name and a Add to Variable action adding it to Venue.
That’s the control flow element sorted, now it’s time to use it all.
Underneath where it says End Menu, add another Text action; this will be the message that is sent out. Enter the message you wish, adding the Venue variable from the Variables menu when you need it.
Next to send the text messages. Add a Send Message action from the Sharing actions and add the first recipient, in this case Tom.
You can add all the recipients to the one Send Message action but then the message is sent out as a group message. In this case, we don’t want that. I want each person to feel individually invited.
To fix this, add two more Send Message actions, one for Dick and one for Harvey.
That’s it, click the play button to test the action.
You’ll be asked to pick the venue and then the venue name will be autofilled into each text message. You’ll have to press send each time but then the workflow will continue to run.
Workflow is a really useful app; you can build very simple workflows or much more complex ones like the one I built in this tutorial.
Although this workflow isn’t super useful, all the tools and techniques we used to make it are. Control flow, in particular, is essential for building powerful workflows.