Learn how to use Siri Shortcuts to create a simple shortcut that allows you to ask a question, and then presents a random answer. The answer is spoken and both the question and the answer are then recorded into a text file on your iCloud Drive. You can use the pieces of this shortcut to build all sorts of useful things based on your needs.
So let's go into the Shortcut's app. If you don't have it with your iOS 12 install go to the Mac App Store and get it. We're going to actually create using scripting here as opposed to all the other different ways of creating Siri shortcuts. So I'm going to create a new shortcut. I'm in the Library and I'm going to Create Shortcut. Now I'm going to start building this.
The first thing I want to do is keep it really simple. It should ask you, you know, to ask a question. So let's go and use the Speak Text action to have it ask you something. But before we do Speak Text we need to have a piece of text for it to speak. I'm going to do a search here for the actions looking for text. Here is one called Text which passes the specified text to the next action. So that's what we want. Basically we want to just set a piece of text. So we'll set it to Ask me a yes or no question. That's all.
Now we want that to be spoken. Here's Speak Text. Put that there and we look for parameters here. Wait Until Finish. Yes, we want it to not go to the next thing until it's finished. There's a Rate, Pitch, and Language that's set to Default. Now we have something we can actually test. So if I run it just says Ask me a yes or no question. Now we want the next thing to do is for it to listen to us. So it can listen to the question. So we're going to search for Dictate here. There's Dictate Text. We'll drag that in here and we can choose a language. So I'll just choose English US. Stop listening we can set to After Pause, After Short Pause, etc. After Pause is good enough for this. So we'll use that.
So this is now going to record the question we're going to ask it. Now we want to generate an answer. It's not just going to be yes or no. It could be all sorts of things, right. So we want to have a list of different answers. Let's look at List here and here's one that allows you to specify a list. So I'll add that. We have 1, 2 as the example. Let's change that to Yes. We'll just make it look good here. Yes. No. We'll do another one, Maybe. Let's continue doing another one. Probably. Let's do Probably Not. Maybe an I have no idea. You can continue to add as many as you want really and you can attach some personality to it.
Now we need to pick a random answer. So we're going to look for List and Get Item From List. We can choose a random item to get from that list. Great. So it's going to get a random item from this list which is exactly what we want. Now we want it to speak that. Speak Text. So it's going to speak it and now we should have something that kind of works. Ask me a yes or no question. Probably not. So now we've got something that actually produces an answer. But let's go even further than that. Let's have it record the actual answer so we have kind of a record of what we're doing.
So we'll learn a few more skills here. What we can do is we can put this in a file using Append to File. So we do Append to File here. We can specify the file. So it's going to default to something in the Shortcuts folder in iCloud drive. Let's leave it at that. We can call it, let's see, Magic Answers.txt. We'll set it to append and make a new line. Now the only problem with this is it's only going to append the answer. We want it to append the question and answer.
What we can do is we'll create another list here and the list here will include, instead of the word one, we'll include a magic variable. The magic variable will be the result of the text that you dictated. Then we will go ahead and put as a two and question mark. Why? Because we want to append a question mark to the end of this. So we have a question mark and then maybe a space. Then item three will actually be the answer which will also be a magic variable. We'll go and grab the item from the list here that is gotten just before it's spoken. Now it's going to take the dictated text, question mark, and it's going to get the answer.
Then we're going to put that together as a piece of text. So, Combine. There's one called Combine Text. Put that here. It will combine it and we'll separate it with Custom and nothing. So it's going to do the question, question mark space, and then item from list. Then it's going to combine those and append it to that file. Now we can have this all put together. We can go to Settings here. We can name this. Let's give it a name like just Magic 8Ball or something. Now we can add it to the Home screen. We can, you know, Add to Siri so we can actually say have Siri say Ask me a question or something like that. So let's go ahead and do that. Play Magic 8 Ball and hit Done.
So let's give this a try. Play Magic 8Ball. Shortcut says Ask me a yes or no question. Should I buy a new MacBook this year? Probably. Now let's look in the Files app here and see whether or not it has saved the answer. There I can see in my Shortcuts folder, I'm in iCloud Drive Shortcuts, there's the Magic Answers text file which is automatically created and there's the line with the question I asked and the answer. So it's going to keep a record of all the questions I've asked.
So you can see a lot of different ways that you can go with this. You don't need to make it a game or something that's just silly and just gives you an answer. You can have it do all sorts of things using these same building blocks.
View the shortcut