Hi, this is Gary with MacMost.com.
Today let's create a shortcut for iPhone that will allow us to use Siri to turn on Do Not
Disturb for a custom amount of time.
MacMost is brought to you thanks to a great group of more than 700 supporters.
Go to MacMost.com/patreon.
There you can read more about the Patreon Campaign.
Join us and get exclusive content and course discounts.
So turning on Do Not Disturb is definitely very useful But usually when you turn it on
it is on until the end of the day.
However a lot of times you want to turn it on just for a short amount of time.
You can bring down the Control Center from the top right.
Tap and hold on Do Not Disturb and then you have options like turning it on for an hour,
Until this evening, or until you change locations, or if you have a meeting or event in the Calendar
that you're right in the middle of it will give you the option to turn it off at the
end of that meeting or event.
But what happens if you just want to set it on for 30 minutes.
You don't want to have to remember to turn it off after 30 minutes because you're probably
not going to.
What about 45 minutes or 22 minutes?
Well, you can create a shortcut to turn Do Not Disturb on and have it turn off automatically
for any amount of time.
Let's create a really good shortcut that we can activate with our voice and specify any
number of minutes and actually even get a confirmation at the end.
So I'm going to go into the Shortcuts app here and let's create a new shortcut and I'll
start right away by adding an Action.
Let's get the current date because what we want to do is turn on Do Not Disturb from
now until now plus so many minutes.
So let's get the time right now.
I'll search for Date and add the date.
Now this gets the full date including the time all the way down to the second.
Now let's ask for a number of minutes for Do Not Disturb to be turned on.
So I'm going to use Ask for input.
Now there is a dictate function where you can have it prompt you to say something and
it will take that input.
But it asks for what text which is a little awkward.
Also this Ask function is a little bit better because if you activate the shortcut using
the screen it will ask you to type input on the screen.
But if you activate it with your voice it will actually listen for a response from your
voice.
So let's use that instead.
Let's make the question this.
This is what Siri will ask us or what will appear as a prompt on the screen.
I'm going to tap Show More and set the input type to Number.
So we'll always get a number as a result.
If for some reason you speak something that's not a number then it's not going to try to
pass some words into the next actions.
Then we're going to add these two together.
We want to take the current time from the first action and add the number of minutes
here from the second one.
So I'm going to tap Plus here and I'm going to look for Adjust Date.
This has a bunch of different things we need to change.
First instead of adding zero we want to tap there and say let's grab the Provided Input.
So it should be the number we provide when we speak how many minutes.
Let's change from seconds to minutes.
The date here, let's tap there and let's choose Date, which is actually taking the result
of that date action earlier.
So now we can actually test this.
I'm going to tap the Play button and it should prompt us on the screen since we're activating
this on the screen.
Sure enough it does.
So let's enter 5.
I'll tap OK and at the bottom there I'll see the result.
Now don't be fooled by that 941 at the top left.
That's the time that's always shown when you're doing screen recording.
The actual time is 8:51 and we can see the result there is, in fact, 8:56 adding five
minutes to that.
So now that we have a time where we can turn Do Not Disturb off let's activate Do Not Disturb.
So I'm going to use the Plus button here.
I'm going to search for Do Not Disturb and use the Set Do Not Disturb action.
Now instead of having turn Do Not Disturb Off we're going to tap that to change that
to On.
Then it will say Until Turned Off and we're going to tap that and say until a Time.
Then it fills a time in there.
7 PM.
I'm going to tap that and I'm going to say no, grab the time from the Adjusted Date.
I'll hit Done.
You can see now it links that action to the previous one.
So now it will actually work.
It will turn on Do Not Disturb and it will turn it off the number of minutes in the future
that we specified.
But let's add a way for us to get a confirmation of this.
So I'm going to tap Plus again and I'm going to look for Speak and choose Speak Text.
I'm going to have the text be something like this.
Then I'm going to tap Adjusted Date.
To use that value again here.
So now Siri will respond saying Do Not Disturb will turn off at and it's going to speak the
whole date.
Remember that was like month, day, year, hour, minute, second.
All of that.
That's not very natural.
What we would like is if it's 8:56 just for Siri to say 8:56 AM.
So let's add another action here.
I'm going to look for Format Date and select that.
Now as the input for that I'm going to choose that same Adjusted Date result.
But I'm going to tap Show More and I can change the date format from Short to Custom.
Now you get this weird string here.
You see the EEE, dd MMM.
That's going to speak out a really complex long date.
But I can select that and customize it.
So I'm going to delete what's there and the date format I'm going to use is lower case
h colon two lower case mm space and three lower case aaa.The h represents the hour,
1 or 12 or whatever, then a colon.
Then mm represents the minute but with leading zero.
So instead of 5 it would be 05.
Then the three a's represent AM or PM.
The great thing is that when Siri is asked to read out a date like 8:56 AM Siri will
say 8:56 AM.
It understands that it is a time and will read it naturally.
So I'll tap Done.
Let's move this up above the Speak part and let's change Adjusted Date, tap on the keyboard
there and backspace and say Format Date.
So the result of our change there from above.
I'll tap Done.
Now let's give it a try.
I'll hit Play.
I'll do 5.
(Siri says, Do Not Disturb will turn off at 9:01 AM) So you can see there Siri speaks
the result.
I also see it here at the bottom inside of Shortcuts.
Now let's go and set this Shortcut up.
I'm going to tap the three buttons here at the top.
I'm going to set it to a name.
The exact words I want to speak when I want to activate this.
So I'll set it to Temporary Do Not Disturb.
I can set it to Albatross if I want, if I want that to be the thing that I speak to
activate this.
Let's set a little Icon up here.
I'll use a blue color and for a GIF I'll go and choose a little moon so it kind of looks
like the little Do Not Disturb icon there.
I don't need it to be shown as a widget in a Share sheet or add it to the Home screen.
I'm going to activate this with my voice.
So I'm going to tap Done and then Done.
I'm going to exit back to the Home screen and test it out.
Temporary Do Not Disturb.
Siri says, Turn on do not disturb for how many minutes?
2, Two.
Do not disturb will turn off at 8:59 AM.
So there we go.
We can actually confirm here that Do Not Disturb has been turned on.
Now let's go and modify this a little bit.
What if we want this to be silent?
After all you get a phone call and you want to turn Do Not Disturb on for 15 minutes while
you're talking on the phone you don't want to put the person on hold while you speak
to Siri and hear that confirmation.
So let's go back into the script here and go to the end and let's get rid of that confirmation
there.
Instead of Speak I'm going to use Alert and you Show alert.
Put exactly the same thing inside of Show Alert.
So now that I've got that setup I can get rid of the Speak part and it will just show
on the screen.
Now we'll go here to the top and I'll tap the three buttons again.
I will add it to the Home screen.
So now I see an icon on the Home screen.
So I can tap that.
Since I activated this on the screen, not with my voice, it will prompt me for something.
I can type the result and it will then give me the Alert rather than speaking it.
So it's completely silent.
You can see Do Not Disturb has been turned on.
The cool thing is I can still use Siri to activate this.
I just won't get the confirmation as spoken text.
I'll just get it on the screen.
So you can choose which one works better for you.
So I'll put an image up at this post at Macmost.com so you can easily recreate this shortcut on
your own.
Hopefully you find it useful or at least a good starting point for creating your own
similar shortcut.