قالب وردپرس درنا توس
Home / Mac / IOS 12 Shortcuts App Part 4: Scripts and Shortcuts

IOS 12 Shortcuts App Part 4: Scripts and Shortcuts



We're back for the latest fee in our four-part series of iOS 12 shortcuts app. The first article introduced readers to the shortcut app by describing the purpose of the app, shortcut user interface, and general settings. The other fee focused on actions, which are building blocks for more complex shortcuts. The third article focused on creating a simple shortcut to demonstrate how to build your own shortcuts, and today's posts provide a more complex shortcut using script tools, as well as links to some useful resources.

The Rocket Yard Siri News Reader Shortcut [1

9659003] Federico Viticci on the MacStory website has been an avid advocate for 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 review the action of the shortcut through action and describe what each action does. When we are done, ask Siri for "Read Rocket Yard Headlines" and the last five headlines from this website are read to you. Let's get started.

1) Create a new, empty shortcut by starting shortcuts and pressing the Create Shortcuts button.

2) Do you want to be a good shortcut? It's a good idea to include comments in your code for future reference and to make your choice of actions clear to others who can use your shortcut. So let's start by adding a commentary. Use the search box at the bottom of the empty shortcut, enter the word "Comment".

  (An explanation of comment activity. Press + to add it to your shortcut)

(An explanation for the comment action. Press + to add it to the shortcut.)

Press the command prompt to edit and then type something like this: "Grab the latest articles from The Rocket Yard. Use this as a Siri shortcut to listen to the headlines."

3) Then we need to set up a [19659009] variable to temporarily hold a number for us. In programming jargon is a variable "a symbolic name associated with a value and whose associated value can 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. Touch the search box again and enter "set variable". All we need to do here is to give the variable a name – "Lines" – and then give the shortcut a value later.

4) Now add another comment and enter "Grabbing headlines from The Rocket Yard". So far so good.

5) Add a text operation. As before, you can either browse through all the different actions available in shortcuts, or simply type the word "Text" in the search box at the bottom of the shortcut. Text Action "sends the specified text to the next action". Enter "The Rocket Yard" in our text.

6) Maintain our good practices, add another comment to describe what we will do next – "Enter RSS feed of the blog we grab headlines from"

7) Now we will actually start doing something! Add a URL action for the shortcut. This action takes a specified URL – in this case the URL of the The Rocket Yard RSS feed – and sends it to the next step in the shortcut. Add the URL action to the shortcut and enter this URL: http://feeds.feedburner.com/owc

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

  • Get its name (headline of the article)
  • Add the header to a variable called "News"
  • Set the variable "Lines" to the value of the "News" variable "

As we went through this process, each subsequent heading is added to the variable" Lines. " At the end of the five, we have the text of the last five headlines. Our loop looks like this (see screenshot below):

  (Slow in shortcut accumulates the text of 5 headlines from the RSS feed)

(Shortcut in the shortcut accumulates the text of 5 headlines from RSS feed.)

8) Now you know how to add actions in a shortcut so we let you find each action, type the correct type of URL (RSS URL) for shortcut to read, add a variable to "News" and put the other into "Lines" in the respective actions and so on.

9) To display the headings, the next step is to place the "Lines" variable in a text field and pass the name of the site, and then display the resulting text in a dialog box on the iOS screen. These two steps are displayed on the screen below:

  (the shortcut actions required to display the headlines on the iOS device screen)

(the shortcut actions required to display the headlines on the screen of your iOS device.)

On this At this point we are finished writing the shortcut. Press the Settings button at the top of the shortcut (looks like two scroll buttons, far below the name "Done," and put a name (I used "Rocket Yard Headlines") for the shortcut, as well as a button icon. [19659002] 10) Run the shortcut by pressing 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 additional credit, we can add this shortcut to Siri. In the shortcut settings, click Add to Siri and say something like "Read rocket site headlines." Siri not only drives the script when you say "Hi, Siri, read Rocket Yard Headlines", but it reads the headlines for you too!

This shortcut does not only work on iPhone and iPad, but also HomePod and AirPods.

Resources
You do not need to bring your own flowchart to create a shortcut, as there are repositories with shortcuts that may already do what you need. It's a resource built right into the shortcut guide – Gallery – which 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 which also contains shortcuts developed by others. If you create a shortcut that is useful and unique, you can upload it to Share. I find that the shortcuts on this site are often useful for learning new programming techniques.

Apple has a shortcut handbook available on the site that is a very useful resource. When I have questions about how an action works or needs clarification, I usually go to the user guide for information.


When you find that you go through too many individual steps to perform some tasks or tasks, consider making life easier by creating a shortcut to automate the entire process. When you get experience with creating your own shortcuts, you'll find that you can even turn complex processes into a single-way shortcut.


Source link