How To: Create A Speaking Clock – Part 1

Are you a person that can easily get lost in time on your computer? By that I mean do you lose track of time when you perhaps have other things to do? If so, here is a ‘Geeky’ trick to make your computer tell you the time hourly. This will work with Vista, Win 7 and Win 8.

Copy and paste the following code into notepad:

Dim speaks, speech
speaks = “The time is ” & hour(time) & ” O’clock”
Set speech = CreateObject(“sapi.spvoice”)
speech.Speak speaks

Save the file as clock.vbs

This will announce the time in hours followed by ‘o’clock’. One thing to mention is if you have your time on your computer set to the 24 hour clock and use the text “O’clock” in the speech line, it will say for example “The time now is 14 o’clock” which sounds a bit silly so it’s better if you use the 12 hour clock.

time1

You can change the wording between the quotation marks in the ‘speaks’ line to what you ever want, for example I have mine set to:
speaks = ” Alan, The time is now ” & hour(time)  & ” O’clock”

In Windows 8 you can also select between a male and a female voice in your ‘Text to Speech’ options. To do this open your Control Panel and in ‘Category’ view click on Ease of Access

time2

… then Speech Recognition.

Click on the Text to Speech link on the left and you will now see a drop-down menu showing your choices.

time3

Select a voice option and then click on the Preview Voice button to hear a demo. Once you are happy with the voice you want to use, click OK and close down the Control Panel.

Double click on the clock.vbs file you created and if the security warning pops up click OK and you should hear the time being spoken to you. If you are happy with the words you selected then it is time to set the schedule otherwise change the wording to what you will be happier with.

A tip here is, if you want to edit the vbs file just rename it adding .txt after the .vbs. This will turn it from a script to a text file, once you are done delete the .txt again.

time4     time5

Open the Task Scheduler by pressing the Win + R keys to open the ‘Run’ box and then type taskschd.msc and press Enter.

time6

In the window that opens, click on Action then Create Task to open another window.

time7

Give the task a name, for example “Speaking Clock”.

time8

Now click on the Triggers tab at the top then New.
In the ‘Settings area set the time you want the schedule to start then under Advanced Settings check the ‘Repeat task every’ box and select the frequency by clicking on the drop down.
In the ‘For a Duration of’ box, click the drop down and select ‘Indefinitely’ and click OK.

time9

Click on the ‘Actions’ tab then on ‘New’.
Click on ‘Browse’ and navigate to your VBS file, highlight it and click on ‘Open’.

time10

Click the Conditions tab and make sure the ‘Start the task only if the computer is idle for’ checkbox is unchecked.
Click OK and OK again to close the windows then close down the Scheduler.
Restart your computer and wait for the talking clock!

A thing to note here is if your task is set to start at 08:00 and to repeat every 15 minutes, then on a restart you won’t hear anything until the time is 00, 15, 30 or 45 minutes past the hour.

If you are on a laptop and want the schedule to run when you are on battery power then click on the Conditions tab and uncheck the ‘Start the task only if the computer is on AC power’ check box.

time11

PS – Make sure your speakers are turned on or you won’t hear anything!

If you want to stop or delete the task then open up your task scheduler again.
Click on Task Scheduler Library then scroll down the window until you see the task.
Highlight it and select an action on the right.

time12

Just as a footnote, I set a time schedule on my wife’s machine while she was at work and said nothing to her. It nearly drove her crazy wondering why her computer had suddenly started telling her what the hour of day was every ten minutes!

Be sure to watch out for Part 2 – coming soon – where I’ll show you a more refined way to have your PC tell you the time.

14 thoughts on “How To: Create A Speaking Clock – Part 1”

  1. I’m getting a Windows Script Host error.

    Line: 2
    Char: 10
    Error: Invalid character
    Code: 800A0408
    Source: Microsoft VBScript compilation error

    1. Post the script here for me to look at Tony. Its saying that it is the 10th character in line 2: speaks = “The time is ” & hour(time) & ” O’clock”
      Have you edited it?

  2. I copied and pasted directly from your site. No editing.

    Dim speaks, speech
    speaks = “The time is ” & hour(time) & ” O’clock”
    Set speech = CreateObject(“sapi.spvoice”)
    speech.Speak speaks

  3. Ok, the problem seems to be when I pasted my article into WordPress the quotation marks mysteriously changed into a curly quotation marks or 6’s and 9’s. Where-ever you see the ” marks, delete them and recreate them with Shift+2 quotation marks, that will fix it.

  4. Shift+2 is the @ sign the compiler doesn’t like that either. Did you mean to enter the ASCII code for the quote sign?

  5. I retyped the ” in the script, and it works. The voice is about 3 minutes faster than the system clock. Is there a easy way to synch the two of them together. This has been a fun project. I learned a lot. Thank’s

  6. Alan,
    This has been great. I put it in 24 hour mode and told her to say:
    Dim speaks, speech
    speaks = “Ralph, The time is now ” & hour(time) & “Hundred hours”
    Set speech = CreateObject(“sapi.spvoice”)
    speech.Speak speaks

    Thanks this is neat, as I get lost in the computer. Can’t wait for part two.

  7. It works now with the retyped ” marks. I have it set for 15 minutes and it still only says the hour. Can this be edited to say the 1/4 hours – 9:15, 9:30, 9:45, 10:00 etc.?

    1. Hi Tony,
      I set the clock in the trigger to be 30 mins and rewrote the script to say:
      Dim speaks, speech
      speaks = “Ralph, The time is now ” & hour(time) & “Hundred 30 hours”
      Set speech = CreateObject(“sapi.spvoice”)
      speech.Speak speaks
      I changed the name clock 30vbs and set it up as a second task so the first task runs on the hour and the second runs at the half hour.
      Have fun.
      Ralph

    2. Dim speaks, speech
      speaks = “It is “& hour(time) &” “& minute(time) &” and “& second(time) &” seconds”
      Set speech = CreateObject(“sapi.spvoice”)
      speech.Speak speaks
      _____

      However, I haven’t figured out how it speaks the time in terms of AM/PM. Sorry.

Comments are closed.

Scroll to Top