Automating the iPhone With Workflow II

Believe it or not, an iPhone can be automated. Yes, the tools aren’t as powerful as you get on macOS, but with apps like Workflow, available for £2.99/$2.99 from the App Store, you can do quite a lot.

Workflow is more like IFTTT than macOS automation apps like Keyboard Maestro. You string together actions from any of dozens of different apps. 

In the previous tutorial, I demonstrated the very basics of Workflow. In this tutorial I’ll dig a little deeper and look at more advanced features like variables. If you haven’t already read the first tutorial, I recommend you do that now before continuing.

Introducing Variables

Variables are one of the most powerful features in Workflow. Rather than each action only passing it’s output on once, a variable lets you save it so you can use it later in a workflow. 

Variables can store text, images, urls, and pretty much any other kind of content you can work with in Workflow.

Creating variables is simple in Workflow: each output is automatically a Magic Variable. You don’t have to do anything dramatic; they’re all there for you to use.

Creating an “I’ll Be Home in X Minutes” Action

I’ll start using variables in a relatively simple example. I’m going to create an action that calculates how long it will take you to get to a specific location, in this case your house, and texts it to a specified contact.

Open Workflow and tap Create Workflow to create a new workflow. For this example, you just need a Normal workflow. Name it something like, “Home in…”

creating new
Creating a new workflow.

The first thing I need to do is define where home is. Go to the Maps actions and add Street Address to the workflow. Enter your address.

adding address
Adding your home address to the workflow.

Next, go back to the Maps actions and add Get Travel Time to the workflow. Select Current Location and Driving, unless you regularly cycle or walk home. Tap the play button to test it.

testing
Testing the travel time check.

You should see how long it would take you to get home from the current location. At the moment, I’m in France so it would take me 19 hours, 30 minutes to drive home to Ireland.

Next, create the message that will share this information. Add a Text action to the workflow.

adding text
Adding a Text action.

Start entering the message you want to send. Something like, “Hey! I’ll be home in [Travel Time]. See you soon. X” is perfect. 

When it comes time to enter the time, tap the button that says Travel Time in the Variables Bar; it displays all the possible variables you can use in the workflow.

adding variable
Inserting a variable.

The last step is to set the workflow up to send a message. 

Add a Send Message action and select the recipient you want. I’m just using my own contact details for the purposes of the demonstration. And a day’s drive away from Dublin.

sending a message
Adding the Send Message action.

Tap Done to finish the action. Now when you run it in Workflow, it will automatically find the travel time and prepare a text to send to a loved one to let them know you’re on your way home.

finished action
Running the finished workflow.

Going Further

This action is pretty good but I can take things a little further. First, I can modify it so it also sends the current location in case traffic or anything changes. Second, let’s add it to the iPhone’s Home Screen.

Open the action again in Workflow. Tap Edit to modify it. As the very first step, add a Get Current Location action.

editng
Editing the action.

Next, edit the Text action. Add a line that says something like, “I’m at [Current Location]”

Add the Current Location variable into the message in the right spot. If you don’t see it in the Variables bar, tap the Magic Wand to see a list of all possible Magic Variables and select it.

adding variable 2
Adding the Current Location variable.

When you’ve finished, tap Done and test the action. 

The last thing to do is add it to the Home Screen so it’s quick and easy to use.

Tap the Settings icon in the action and then tap Add to Home Screen.

Adding to home screen
Adding the workflow to the Home Screen.

Customise the icon so it looks how you want and then tap Done.

Customising the logo
Customising the logo.

Save the web page to the home screen by tapping the Share icon and then Add to Home Screen. Now the workflow will run whenever you tap the button.

The finished action
The finished action on my Home Screen.

Wrapping Up

Variables are a really powerful way to add functionality to workflows. Instead of just relying on a linear sequence of actions, you can store information and use it later on. 

Workflow makes it really easy to work with variables. Rather than having to create or declare your own, through Magic Variables, every output is available for you to use. 

In this tutorial I’ve looked at a really simple way to use two variables to create a text message that shares a location and travel time to. There are many more advanced features of variables and Workflow that we’ll explore over the next few lessons.

{excerpt}
Read More

Leave a Reply

Your email address will not be published. Required fields are marked *