How to make Windows speak the time at the top of the hour

Since Windows XP, all versions of Windows OS have Narrator installed.

It can be programmed to speak in applications.

There is a simple VBscript method of making it say something under program control, such as if it receives a file that indicates the voltage is too low on one of the data loggers, Python to say it out loud, like so:

import os
etc
os.exec("c:/users/Admin/python/lowvolt.vbs")

where lowvolt.vbs looks like this:

Dim sez, speech
sez = "Low Voltage on 24"
Set speech = CreateObject("sapi.spvoice")
speech.Speak sez
Wscript.Quit

Which works great.

(You can see the input plotted HERE)


It would be helpful to have it also announce the time at the top of each hour.

Question is in the title - How to do this?


Create a VBscript text file called saytime.vbs

Dim speech, hr, sez
hr=hour(time)
if hr=0 then
    hr = 12
end if
if hr>12 then
   hr = hr - 12
end if
sez = hr & " O'clock"
Set speech = CreateObject("sapi.spvoice")
speech.Speak sez
Wscript.Quit

Then set up a Scheduled Task to run it.

  • Open Task Scheduler - click Start, type in "scheduler" then press enter

  • On the right pane, click "Create Task..."

  • Give it a name - perhaps "Say Time" - below that you will see the security options default to having it run only when the current user is logged in.

  • Select (click) on the "Triggers" tab, then the "New..." button - It will be set to One time.

  • Modify the Start Time so the time looks like: 12:00:00 to make it trigger at the top of each hour.

  • Check the box for "Repeat task every" - set it to 1 hour and for a duration of Indefinitely.

  • Check box for "Stop task if it runs longer than" and set it to 30 minutes

  • Click OK

  • Click on the "Actions" tab, then the "New..." button - It will open with Action set to Start a Program.

  • Browse to your saytime.vbs file

  • Click OK, then OK

  • Now, on the left side, click on "Task Scheduler Library"

  • Find your new entry, right-click on it and then click on Run

When you hear the voice say the time you know the task is working.
You can also see the trigger conditions.

At this point, your setup is done.

Voila - your computer will then speak the hour.


Note that Narrator sets the actual voice you will hear. It has a few built-in options for male and female voices.

To set Narrator voice options (Microsoft)

There are methods for downloading more voices that will work with Narrator:

Get more Microsoft text-to-speech voices (Superuser.com)

Best Free Windows Narrator Voices You Can Use (Zero2000.com)


I have set my Windows and Ubuntu machines so they all are set to the Master Clock, and have taught them all to speak. Hearing them all announce the time simultaneously is very gratifying:

https://askubuntu.com/questions/972799/how-do-i-set-ubuntu-to-use-the-primary-time-server-time-nist-gov/972800#972800

https://askubuntu.com/questions/977613/16-04-lts-how-to-make-the-system-announce-the-time-at-the-top-of-the-hour-with-e


Also, for fans of VBscript, this is a link to a VBS script that can play MP3 files under program control:

https://stackoverflow.com/questions/1569765/how-to-play-audio-file-on-windows-from-command-line/18165191#18165191


Brilliant script, thanks! I've modified the script slightly to include am/pm and minute announcements so you can run it any time:

Dim speech, hr, sez, mt, pm
hr=hour(time)
mt=minute(time)
pm="pea em"
if hr=0 then
    hr = 12
elseif hr>12 then
    hr = hr - 12
elseif hr < 12 then
    pm="ay em"
end if
if mt=0 then
  sez = "It's " & hr & " " & pm
elseif mt < 10 then
  sez = "It's " & hr & " oh " & mt & " " & pm
else
  sez = "It's " & hr & " " & mt & " " & pm
end if
Set speech = CreateObject("sapi.spvoice")
speech.Speak sez
Wscript.Quit