While there is no Clock app on a Mac yet, you can use the Calendar to set an alarm for any time on any day. By adding an Automator script, you can have that alarm play a sound at full volume or speak some text.
You can also watch this video at YouTube.
Watch more videos about related subjects: Automator (50 videos).
You can also watch this video at YouTube.
Watch more videos about related subjects: Automator (50 videos).
Video Transcript
Hi, this is Gary with MacMost.com. Today let me show you how to create an alarm clock using Automator and the Calendar App on your Mac.
MacMost is brought to you thanks to a great group of more than 1000 supporters. Go to MacMost.com/patreon. There you can read more about the Patreon Campaign. Join us and get exclusive content and course discounts.
If you have ever tried to set an alarm on your Mac you know it can be kind of frustrating. If you ask Siri you won't get any help. (Siri set an alarm for 1 pm. I can't set an alarm here. How about a reminder instead). Of course you can set a reminder but a reminder is going to give you kind of a quiet notification with a little thing at the top right hand corner of your screen. That's fine for getting a notification while you're working but if you're in another part of the room or taking a nap it's not going to wake you up. Now there are other ways to set alarms on your Mac. For instance, you can get a third party app to do this in the App Store. But these either cost money, bug you for in-app purchases, or show advertisements in them.
Another thing you can do is you can go into the Calendar. In the Calendar you can set an event to happen at a certain time. You can even associate a sound with that event. But sometimes you may have the volume on your Mac set too low for that to work and it's kind of clunky to constantly be setting these events in the Calendar. So let me show you an easier way you can do it using the Calendar but also using Automator. Setting this up the first time is going to have a lot of steps. But once you have it setup I'm going to show you how easy it is to then reuse that alarm easily.
So let's start off here in Automator. I'm going to use the Calendar Alarm here. So let's choose and I'm going to lookup JAVA Script, because I'm going to use JAVA Script instead of Apple Script like I always do, and use run JAVA Script here to write a simple script that will work in Automator. You would think there would just be some Automator actions that you could add that would play a sound but that's not the case. You could have some music played in the Music App. It's kind of clunky. So instead let's have it done here with JAVA Script.
Okay, so here's my script. You can see I start off here with the regular function declaration and then I use app equals the current application here just to give us something to trigger these things. Include StandardAdditions so we can do a lot of scripting with this app. Now we're going to get the original volume so the volume where the system preferences are set right now. That way we could set it back to that later on. Fortunately the volume settings output volume gives us a number between a zero and a hundred instead of up to seven. So to get a number between zero and seven we divide by hundred multiplied by seven. Then we go and set the current volume all the way up to the top to seven. Then we're going to display Notifications. I like to display the notifications instead of using something else to trigger the sound because it puts something visual on the screen and it's simple and easy to do. I'm just going to call this Notification Alarm Clock. That's all it needs to show there. I'm going to set to the sound Rooster. Now where's the Sound Rooster? Well, in the Finder if you use the Go Menu here, hold the option key down and go to your User Library, so this is not the System Library but the User Library, you'll find a folder called Sounds. If it's not there you can always create it. In there you'll find anything you've added that has a custom system sound. So I put a file in there called Rooster.MFA, it's a simple little rooster sound, and if this was an AIFF file it would actually appear in System Preferences. Since it's not it won't appear in System Preferences as an alert sound but I can still use it as a Notification Sound.
So then after showing the Alert with that sound it's going to wait three seconds. Why? Well, we're going to set the volume back to the original volume. If we do that immediately then you'll only hear the sound played at the original volume. You want to delay three seconds. Give the sound sometime to play before going back to the original volume. So let's give this a test run. Here I'm going to use the Run button and (rooster crowing) and you could see the alert show up. Great. So, let's save this. When I go to Save it will tell me there's a calendar alarm in Automator. It's going to say Saved Calendar alarm as and I'll just call it Alarm Clock and Save. Then it's going to launch the calendar app. It's going to play it right away. Notice what it did here. It created
Automator calendar here on my Mac. That's because, of course, syncing these to the iPhone or something would be useless.There's no Automator there. So this is just going to run on my Mac, which is perfect! I don't want my alarms going off on all my Apple devices. This is an alarm I'm making for my Mac.
Now in this Automator Calendar is this alarm clock here. It's just this one event, an entire calendar for one event. Great. I can go to the alarm clock here and I could see there's the time for this alarm so I'll change it to something in the future. Now I can Quit Calendar and I could Quit Automator. When the clock strikes 12:03 it should give me that alarm which is going to be a Notification including that sound. There you go. You see the Calendar notification and the notification coming from the Automator action there.
Now you may be saying, boy that's a lot of steps to set an alarm on a Mac. But you only have to do most of the steps the first time you set this up. Because this isn't going anywhere. You could see it's still here set for that time. So if I want to use the alarm again all I need to do is change the time for the alarm. So I can set it to another time. So just keep moving this forward in time using it whenever you need to. You could even get rid of this display notification and instead have it speak something. Something like this so now when you run this, (Wake Up) you get a bit of synthesized speech instead. You could set this to whatever you want. You could have it even loop here. So I've created a simple little forward loop to go three times, speak something, delay three seconds and then it would speak it again and do that three times and then set the volume back at the end. You could add a Using Parameter here to have it speak with one of the other standard voices. (Wake Up).
So I hope that could be handy for some people. It's not ideal. I wish Apple would, at some point in the future, add a full clock app with an alarm to the Mac. Maybe we'll see that in an upcoming version of macOS. Thanks for watching.
Here is the code for the script:
function run(input, parameters) { let app = Application.currentApplication() app.includeStandardAdditions = true let originalVolume = app.getVolumeSettings().outputVolume*7/100 app.setVolume(7) app.displayNotification("Alarm Clock", { soundName: "Rooster" }) delay(3) app.setVolume(originalVolume) }
Hi Gary, that was brilliant and so much fun to do. Thank you for all your excellent video tutorials.
Hello, I am copying the code for the script, but I would have to edit out the "rooster" sound, since I don't have that in my computer. I am copying and pasting the one sound I have downloaded to my Mac, and it doesn't work :(
Ana: Just make sure you put the sound in the right place and the name matches exactly. And make sure it is the right format too.
How to use scripts for automator using your scripts with simple copy and paste?
Edgard: Watch the video and see how I do it.