Wilson: Build a mileage calculator on your iPhone using Shortcuts

  • Print
Listen to this story

Subscriber Benefit

As a subscriber you can listen to articles at work, in the car, or while you work out. Subscribe Now
This audio file is brought to you by
Loading audio file, please wait.
  • 0.25
  • 0.50
  • 0.75
  • 1.00
  • 1.25
  • 1.50
  • 1.75
  • 2.00

What is one device that you always have with you? Yes, your phone. One of the benefits of an iPhone is its ability to run apps that make life better. You can buy apps, sure, but what if you could make your own app? What if you could make multiple apps, each that solves your own specific procrastination tendency?

Assuming you use an iPhone (or iPad), you already have an app-building tool called Shortcuts. Think of Shortcuts as a Lego-like tool for building a shortcut on your device. Say you want to track your mileage to attend a court hearing and input that as an expense entry in your billing program.

Each of us probably has a process for doing so, and the process is much easier in today’s GPS-driven world. But tracking mileage is a good example of making your own tool because it demonstrates the power of Shortcuts.

Step 1: Know where you are going (Begin at the end)

Map apps work best when you enter a destination. So it is with a Shortcut. It is important to start with what you actually want to achieve with your Shortcut and then work backward to make it. The goal of this Shortcut is to use your iPhone to create an expense entry to email yourself. Start by writing out a typical expense entry — something like, “Travel to and from courthouse (50 x 2 = 100 miles).”

Step 2: Make your packing list

Next, determine what additional information is needed to create that mileage entry. What other data fields does your billing program require you to enter for an expense? Open the billing program and add a new expense entry to find out. Look at the “blocks” of information required. Create a list of the “blocks” of information you might need — things like the date, the description and perhaps an expense code. You want your Shortcut to prompt you for all the needed data (like a checklist).

Because you are building the app, you get to decide how it works and match it to your existing workflow. Don’t try to make a new habit: just automate what you already do.

You won’t be able to automate everything in one Shortcut. That’s OK. Use Shortcuts to defeat the tendency to procrastinate. The key is getting the process started. Resist the urge to automate 100% of the process. You can always add “features” later.

Step 3: Create the Shortcut

This is a bit technical but will teach you several different concepts in one Shortcut. Take it one block at a time.

Open the Shortcuts app on your device. Tap “create new” (or look for the +) sign. Name the Shortcut.

Next, find the box that says, “Search for apps and actions.” Type the word “Ask” in that search bar and drag the Ask block into your Shortcut. Set the Ask block to Ask for “Text” and type a Prompt (“Where did you go?”). The prompt will appear when you use the Shortcut, asking you to fill in the answer to the prompt.

Next, because we want to reference this information later, assign a “variable” to the Ask block. Variables are simply memorized blocks of information. In the Search area, type, “Set variable,” and connect that block to the Ask block. Type, “TripName,” as the variable. Shortcuts sets the variable “TripName” to “Provided Input.” You will see a short vertical line connecting the two blocks; the concept is that information flows from one block to the next block.

Now add another Ask block with the prompt “Start Miles.” Use Number instead of Text. Set a variable to “StartMiles.” Next, add an Ask block for a Number with prompt “End Miles.” Set the variable to “EndMiles.”

Next, add a calculation. Search for Calculation and add that block. In the Calculation block, insert the variable EndMiles and subtract from it StartMiles. Set a variable to the result for “TotalMiles.”

Next, add another calculation. This time use the variable TotalMiles divided by 2 to get a one-way miles amount. Set a variable to the result: “OneWayMiles.”

Now add a Text block. Right click, insert “Current Date” and choose the appropriate format (e.g., ISO 8601). After the Current Date variable, enter: “Travel to and from “TripName” (“OneWayMiles” x 2 = “TotalMiles” miles). Replace the “” information with the variables to automatically insert that information.

The final step is to add a Copy to Clipboard action. Connect that to the Text block you just created. This will copy all your work to the iPhone’s clipboard.

Now use the shortcut (click the right triangle/play button), fill in the information and paste the results into an email.•


Seth R. Wilson is an attorney with Adler Attorneys in Noblesville. In addition to practicing law, he helps manage the day-to-day technology operations of the firm. He writes about legal technology at sethrwilson.com and is a frequent speaker on the subject. Opinions expressed are those of the author.

Please enable JavaScript to view this content.

{{ articles_remaining }}
Free {{ article_text }} Remaining
{{ articles_remaining }}
Free {{ article_text }} Remaining Article limit resets on
{{ count_down }}