Make Your Computer Talk: Stupid Geek Tricks

Making Your Computer Talk: A Guide to Text-to-Speech
The concept of machines communicating through speech is frequently depicted in science fiction. However, it’s entirely possible to enable text-to-speech functionality on a standard computer.
While computers haven't reached the level of human-like interaction seen in films, readily available tools and scripts allow Windows machines to audibly convey information.
Utilizing Built-in Windows Features
Windows operating systems include native text-to-speech capabilities. These features can be accessed and customized without the need for additional software installations.
The system allows for adjustments to voice characteristics, such as speed and pitch, providing a personalized auditory experience.
Simple Scripting for Speech Output
Beyond the built-in features, basic scripting can be employed to trigger speech output. This offers greater control and flexibility in how and when your computer "speaks."
These scripts can be integrated into various applications, automating announcements or providing auditory feedback for specific events.
Applications of Computer Speech
The ability for a computer to speak has numerous practical applications. It can enhance accessibility for visually impaired users, providing an alternative way to interact with digital content.
Furthermore, speech output can be used in automated systems, such as alerts or notifications, improving user awareness and responsiveness.
Exploring Further Options
Several third-party applications expand upon the native Windows text-to-speech functionality. These often offer more advanced voice options and customization features.
Text-to-speech technology continues to evolve, bringing us closer to the seamless human-computer interaction often portrayed in futuristic scenarios.
The Origins of Visual Basic Scripting
The initial version of VBScript, or Visual Basic Scripting Edition, was introduced in 1988. However, this early iteration was considerably less sophisticated than the VBScript utilized today.
Driven by a growing demand for a scripting language that was both accessible and lightweight within the Microsoft ecosystem, the company continued its development efforts.
This culminated in the public release of VBScript in 1996.
VBScript's Functionality and Integration
VBScript is a straightforward scripting language that leverages COM (Component Object Model) for file management operations.
Specifically, it enables users to create, read, update, and delete files within Microsoft operating systems.
Since its inclusion with Windows 98, VBScript has been a standard component of every Windows installation.
Its adaptability stems from the ability to embed the VBScript host environment directly within applications using the Microsoft Script Control.
Commonly, VBScript is employed in conjunction with Internet Information Services, the Windows Script Host, and Internet Explorer.
Now, let's move beyond the technical details and explore how to utilize VBScript to enable communication with your computer!
Creating Simple VBScripts
Developing a Visual Basic Script is a straightforward process that doesn't necessitate specialized software. While advanced scripting can benefit from dedicated programs, many programmers and hobbyists utilize Microsoft Notepad for creating basic scripts.
Begin by launching Notepad. Once open, either type the following code directly into the window or copy and paste it. To customize the spoken output, replace the phrase “The geeks shall inherit the earth” with your desired text.
Dim speechObjectSet speechObject = CreateObject("sapi.spvoice")
speechObject.Speak "The geeks shall inherit the earth"

After successfully entering the text you want the computer to vocalize, select “File” from the menu and then click “Save As…”.

Choose a location to save the file. For this instance, it’s being saved to an empty folder within the Downloads directory. Crucially, ensure the filename ends with the .vbs extension. This informs the computer that it’s a VBScript file, not a simple text file.
We’ll name this example “Geek test.vbs”, as illustrated below.

Now, close Notepad and navigate to the folder where you saved the script. The icon will differ from a standard TXT file icon. It will appear as a small blue scroll on a white background. Double-click this icon to execute the script and hear the specified text. You have now successfully created your first script!
To reinforce your understanding, try creating additional scripts with different text. Alternatively, you can right-click the VBScript file, select “Open with…”, and choose Notepad to modify the text directly within the existing file.

VBScripts offer a simple way to automate tasks. Experimenting with different phrases will help you learn the basics of scripting.
Creating a Text-to-Speech Script
Having learned to create and execute a basic script, you might be seeking a more engaging challenge. This tutorial will guide you through developing a slightly more sophisticated script.
We will now explore how to build a script that allows you to input text via a dialog box, and then have your computer audibly read that text back to you.
Begin by launching Notepad and entering the following script, or alternatively, copy and paste it directly into the Notepad window.
Dim message, sapi
message = InputBox("What shall I say, your Geekness?", "I speak for you.")
Set sapi = CreateObject("sapi.spvoice")
sapi.Speak message
Once the code is entered, save the file as “Text to Speech.vbs”, mirroring the saving process used for previous scripts. This finalizes the script creation.
Locate the saved file and double-click it to execute. A window titled “I speak for you.” will appear, prompting you to enter the text you wish to be spoken aloud with the question “What shall I say, your Geekiness?”
These prompts can be customized to display any desired phrasing. Feel free to modify them to your preference.
As a test, enter the phrase “The geeks shall inherit the earth” and click the “OK” button. The script will then execute, and you will hear your entered text vocalized by your computer.

A Welcoming VBScript Implementation
The exploration of VBScript continues, moving beyond basic interactions to incorporate time-sensitive responses. This script aims to personalize the computer's interaction by offering a greeting appropriate for the current time of day.
Begin by launching a new text editor, such as Notepad. Then, input the following script, customizing the greetings and the user's name as desired.
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")Dim str
If Hour(Time) < 12 Then
Sapi.Speak "Good Morning Geekmeister "
Else
If Hour(Time) > 12 Then
If Hour(Time) > 16 Then
Sapi.Speak "Good evening Geekmeister "
Else
Sapi.Speak "Good afternoon Geekmeister "
End If
End If
End If

Following script entry, save the file with a ".vbs" extension. Executing the saved file—by double-clicking it—will trigger the script. The computer will then vocalize a greeting based on the system's current time.
The logic within the script determines the appropriate greeting. Times before noon are classified as morning, while those after noon are considered afternoon. However, a further condition specifies that any time past 4:00 PM (16:00) is designated as evening.

VBScript provides a simple method for creating interactive experiences. This example demonstrates how to leverage system time to deliver a personalized greeting.
VBScript for Announcing the Time of Day
For users seeking more functionality, a VBScript can be created to verbally announce the current time. This involves crafting a new text file and inputting the necessary script code.
While the script’s structure might initially appear complex, it fundamentally instructs the computer on what to articulate and how, based on the system’s current time. The introductory phrase, "The current time is," can be readily customized to suit individual preferences.
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak "The current time is"
if hour(time) > 12 then
Sapi.speak hour(time)-12
else
if hour(time) = 0 then
Sapi.speak "12"
else
Sapi.speak hour(time)
end if
end if
if minute(time) < 10 then
Sapi.speak "o"
if minute(time) < 1 then
Sapi.speak "clock"
else
Sapi.speak minute(time)
end if
else
Sapi.speak minute(time)
end if
if hour(time) > 12 then
Sapi.speak "P.M."
else
if hour(time) = 0 then
if minute(time) = 0 then
Sapi.speak "Midnight"
else
Sapi.speak "A.M."
end if
else
if hour(time) = 12 then
if minute(time) = 0 then
Sapi.speak "Noon"
else
Sapi.speak "P.M."
end if
else
Sapi.speak "A.M."
end if
end if
end if
Following the creation of the script, it must be saved with a .vbs extension, mirroring the process outlined previously. Subsequently, navigating to the file’s location and double-clicking it should initiate the script, resulting in the computer audibly announcing the current time.
Personalized Computer Startup
Having learned how to configure your computer to offer a verbal greeting and announce the time, consider the possibilities of automating this process upon system startup. Implementing this functionality is surprisingly straightforward, involving a simple combination of previously created scripts placed in a designated location.
Begin by launching Microsoft Notepad and copying the following code directly into the application window. This code represents a consolidated version of the earlier scripts, designed for seamless execution. Feel free to customize the greeting to your preference – options include “What’s up dude,” “Hello Master,” or “Greetings your almighty highness,” tailoring the interaction to your liking.
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")dim str
if hour(time) < 12 then
Sapi.speak "Good Morning Geekmeister "
else
if hour(time) > 12 then
if hour(time) > 16 then
Sapi.speak "Good evening Geekmeister "
else
Sapi.speak "Good afternoon Geekmeister "
end if
end if
end if
Sapi.speak "The current time is"
if hour(time) > 12 thenSapi.speak hour(time)-12
else
if hour(time) = 0 then
Sapi.speak "12"
else
Sapi.speak hour(time)
end if
end if
if minute(time) < 10 thenSapi.speak "o"
if minute(time) < 1 then
Sapi.speak "clock"
else
Sapi.speak minute(time)
end if
else
Sapi.speak minute(time)
end if
if hour(time) > 12 thenSapi.speak "P.M."
else
if hour(time) = 0 then
if minute(time) = 0 then
Sapi.speak "Midnight"
else
Sapi.speak "A.M."
end if
else
if hour(time) = 12 then
if minute(time) = 0 then
Sapi.speak "Noon"
else
Sapi.speak "P.M."
end if
else
Sapi.speak "A.M."
end if
end if
end if
After accurately copying the complete code into Notepad, save the file as “Startup greeting.vbs”. While alternative filenames are permissible, using this name simplifies the demonstration and ensures consistency. To test the script, simply double-click the saved VBScript file to hear the greeting and time announcement.

To enable the script to run automatically upon computer startup, mimicking systems like Jarvis from Iron Man, select the file and drag it using your mouse pointer towards the “Start button.” Maintain a click and drag motion, moving the file onto “All Programs,” then locate and release the mouse button within the “Startup” folder.

Should the drag-and-drop method prove unsuccessful, manual navigation to the startup folder is an alternative. First, locate the directory where “Startup greeting.vbs” is saved and copy the file.
Next, enter the following path into the address bar of any Explorer window and press “Enter”. Remember to replace “USERNAME” with the actual name of your computer account.
C:\Users\USERNAME\AppData\Roaming\Microsoft\
Windows\Start Menu\Programs\Startup
Once inside the startup folder, paste the VBScript file. Upon subsequent computer startup and login, the script should automatically execute, providing a personalized greeting and the current time.

For convenience, the individual scripts are available for download via the following links, should you encounter any difficulties during creation.
- Geek Test
- Greeting
- Startup Greeting
- Telling Time
- Text to Speech