Skip to main content
X

Send us a Topic or Tip

Have a suggestion for the blog? Perhaps a topic you'd like us to write about? If so, we'd love to hear from you! Fancy yourself a writer and have a tech tip, handy computer trick, or "how to" to share? Let us know what you'd like to contribute!

Thanks for reaching out!

The iOS 12 Shortcuts App Part 4: Scripting Tools and Shortcuts Resources

Rocket Yard Headlines

We’re back for the last installment in our four-part series about the iOS 12 Shortcuts app. The first article introduced readers to the Shortcuts app by describing the purpose of the app, the user interface of Shortcuts, and general settings. The second installment focused on actions, which are the building blocks of more complex shortcuts. The third article focused on creating a simple shortcut to demonstrate how to construct your own shortcuts, and today’s post provides a more complex shortcut using scripting tools as well as links to some helpful resources.

The Rocket Yard Siri News Reader Shortcut

Federico Viticci of the MacStories website has been a fervent advocate of iOS automation for several years, and he created a shortcut that acts as a verbal news reader for your favorite website. In this post, we’ll go through his shortcut action by action and describe what each action is doing. When we’re finished, you can ask Siri to “Read Rocket Yard Headlines” and the five most recent headlines from this website are read to you. Let’s get started.

1) Create a new, empty shortcut by launching Shortcuts and tapping on the Create Shortcut button.

2) Want to be a good shortcut scripting programmer? It’s a great idea to insert comments into your code for future reference and to make your choice of actions clear to others who may use your shortcut. So let’s start by adding a comment action. Using the search field at the bottom of the empty shortcut, enter the word “Comment”.

An explanation of the Comment action. Tap + to add it to our shortcut

Tap the Comment action to edit it, then type in something like this: “Grab the latest articles from The Rocket Yard. Use this as a Siri shortcut to listen to the headlines.”

3) Next, we need to set up a variable to temporarily hold a number for us. In programming jargon, a variable is “a symbolic name associated with a value and whose associated value may be changed”. In this case, we need to create a variable to capture and hold the number of lines of text to be displayed or read from an RSS feed. Tap on the search field again, and type “set variable”. The only thing we need to do here is give the variable a name — “Lines” — and then the shortcut assigns a value later on.

4) Now, add another comment action and enter “Grabbing headlines from The Rocket Yard”. So far, so good.

5) Add a Text action. As before, you can either scroll through all of the various actions available in Shortcuts or just type the word “Text” into the search field at the bottom of the shortcut. The Text action “passes the specified text to the next action”. In our Text action, type “The Rocket Yard”.

6) Maintaining our good practices, add another Comment to describe what we’ll do next — “Enter the RSS feed of the blog we’re grabbing headlines from”

7) Now we’re going to actually start doing something! Add a URL action to our shortcut. This action takes a specified URL — in this case, the web address of the RSS feed for The Rocket Yard — and passes it to the next step of the shortcut. Add the URL action to the shortcut and enter this URL: http://feeds.feedburner.com/owc

What our shortcut is going to do is get five items from the RSS feed for The Rocket Yard, and then loop through a process for each of those five items:

  • Get its name (the headline of the article)
  • Add that headline text into a variable called “News”
  • Set the variable “Lines” to the value of the variable “News”

As we loop through this process, each successive headline is added to the variable “Lines”. At the end of five loops through this, we have the text of the last five headlines. Our loop looks like this (see screenshot below):

The loop in the shortcut accumulates the text of 5 headlines from the RSS feed
The loop in the shortcut accumulates the text of 5 headlines from the RSS feed

8) By now you know how to add actions to a shortcut, so we’ll leave it to you to find each action, enter the appropriate type of URL (RSS URL) for the shortcut to read, add one variable to “News” and set the other to “Lines” in the respective actions, and so on.

9) To display the headlines, the next step is to place the variable “Lines” in a text field and pass along the name of the website, then show the resulting text in a dialog on the iOS device screen. Those two steps are seen in the screenshot below:

The shortcut actions required to display the headlines on the screen of the iOS device.
The shortcut actions required to display the headlines on the screen of the iOS device.

At this point, we’re done with coding the shortcut. Tap the settings button at the top of the shortcut (looks like two toggle buttons, far right under the word “Done”, and set a name (I used “Rocket Yard Headlines”) for the shortcut as well as a button icon.

10) Run the shortcut by tapping on it. The result is a text dialog that looks like this (see screenshot below):

The result of running the shortcut
The result of running the shortcut.

For extra credit, we can add this shortcut to Siri. In the shortcut settings, tap Add to Siri and say something like “Read Rocket Yard Headlines”. Siri not only runs the script when you say “Hey, Siri, read Rocket Yard Headlines”, but it reads the headlines to you as well!

This shortcut not only works on your iPhone and iPad, but HomePod and AirPods as well.

Resources

You don’t need to come up with your own flowchart for creating a shortcut, as there are repositories of shortcuts that may already do what you need. There’s one resource built right into the Shortcuts app — the Gallery — that has a number of shortcuts that can be added to your Library and edited to your needs.

Sharecuts is a website created by developer Guilherme Rambo that also features shortcuts developed by others. If you create a shortcut that is useful and unique, upload it to Sharecuts. I find that the shortcuts on this site are often useful for learning new programming techniques.

Apple has a Shortcuts User Guide available on its website that is a very useful resource. Whenever I have a question about the way action works or need clarification, I usually head to the User Guide to gain enlightenment.


Whenever you find that you’re going through too many individual steps to perform some task or tasks, consider making your life easier by creating a shortcut to automate the entire process. As you gain experience creating your own shortcuts, you’ll find that you can turn even complex processes into a one-tap shortcut.

Steve Sande
the authorSteve Sande
Contributing Author
Steve has been writing about Apple products since 1986, starting on a bulletin board system, creating the first of his many Apple-related websites in 1994, joining the staff of The Unofficial Apple Weblog in 2008, and founding Apple World Today in 2015. He’s semi-retired, loves to camp and take photos, and is an FAA-licensed drone pilot.
Be Sociable, Share This Post!

Leave a Reply

3 Comments

  • Hello,
    My cars Bluetooth doesn’t automatically connect anymore for whatever reason. I was wondering if it’s possible to create an automation that when I get to my cars parked location it would attempt to manually connect to Bluetooth that I have previously access

  • First of all, I would like to thank Steve Sande for authoring this four-part series of articles about the iOS 12 Shortcuts app

    As a blind iOS user and new to the Shortcuts app, I am looking forward to writing my own scripts to streamline the accessibility of the iOS apps which I use in my daily life

    Thanks again!,
    Gary

  • Thank you so much for this primer on Shortcuts. I’m trying to automate warming up my car and this teaching series is truly fantastic. Not sure I can script anything but I’m going to give it a shot.
    Thanks!