- slide 1 of 5
What is Microsoft Sam?
Microsoft Sam is the useful text to speech tool found in the Windows XP Control Panel under Speech in Classic View and Sounds, Speech and Audio Devices > Speech in Category View.
Most often, it is used as a novelty - type in a few words and listen to the text to speech voice synthesis read out your message.
Beyond this however, Microsoft Sam has more uses and is the main element of Narrator, a screen reading accessibility application that is included with Windows 2000 and XP.
You can try out Narrator by loading it up - go to Start > Programs > Accessories Accessibility.
This screen reader can be used to read many active windows - particularly webpages - however, it isn't designed to be used with notepad.
- slide 2 of 5
Using Microsoft Sam with Visual Basic
Thanks to the VB code made available by this developer however, Microsoft Sam can be used to read .TXT files from Notepad.
There are obvious benefits for this - for instance, Narrator fails to read Word documents successfully and any number of rich text, MS Word format or other document types can be copied into a raw text (.TXT) document, saved and read out by Microsoft Sam.
- slide 3 of 5
Saving and Naming the Script
The following script between the "===" should be copied and pasted into a new Notepad document.
'Script written by Ayman Farhat (SCRIPTmaster)
'This script allows your PC to read contents of any text file you choose!
Const ForReading = 1
strText = InputBox("Please type in the name of the file you want to read the file, the file has an extension .txt","Read text files from notepad")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objText = objFSO.OpenTextFile(strText + ".txt", ForReading)
strText = objText.ReadAll
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Save the script, naming it reader.vbs - note the .VBS file extension to denote a Microsoft Visual Basic script.
- slide 4 of 5
Copy the paragraphs into a new text file in Notepad and save the file - don't enter a file extension but give the file a memorable name, and ensure it is saved in the same location as reader.vbs.
To have Microsoft Sam read the text file, browse to the location of reader.vbs and run it. A dialogue box will appear, as pictured here - simple enter the name of the text file, without the .TXT extension and click OK. The voice of Microsoft Sam will then be heard as Narrator reads the file from beginning to end!
- slide 5 of 5
Check out Notepad Mobile - Polished Wordprocessing and Coding to learn about a raw text editor for Windows Mobile.