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.
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…
… 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.
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.
Open the Task Scheduler by pressing the Win + R keys to open the ‘Run’ box and then type taskschd.msc and press Enter.
In the window that opens, click on Action then Create Task to open another window.
Give the task a name, for example “Speaking Clock”.
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.
Click on the ‘Actions’ tab then on ‘New’.
Click on ‘Browse’ and navigate to your VBS file, highlight it and click on ‘Open’.
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.
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.
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.
Thanks, very interesting article 🙂
Can’t wait for Part 2!
I’m getting a Windows Script Host error.
Line: 2
Char: 10
Error: Invalid character
Code: 800A0408
Source: Microsoft VBScript compilation error
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?
I had the same issue, just replaced the speech-marks. it worked
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
I’m getting it also it appears to be the Quote.
speaks = “
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.
By the way, do it in line 3 also!
Shift+2 is the @ sign the compiler doesn’t like that either. Did you mean to enter the ASCII code for the quote sign?
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
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.
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.?
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
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.