Below is some Just Basic Compiler code that will pass a string to a vb object and create speech. I've used it with Vista and it still works. Could someone help me write a reusable speech class or module for 2008 express version that will accept strings and return speech? I am sure there is someway to convert this code to a vb class or module, but I am still new to classes and objects, but this will be a good way to start my class library. Then I could just add a reference to a project and have talking programs. I've tried using the speech sdk, but it won't work right with vista. But running this .vbs through the JB compiler works fine with Vista. There is a system.voice reference in the vb ui, but I can't find any info on it in the compiler index. Any help would be appreciated.
Code:nomainwin open "speak.vbs" for output as #1 print #1, "Set MyVoice = CreateObject("; chr$(34); "Sapi.SpVoice"; chr$(34); ")" print #1, "Set fso = CreateObject("; chr$(34); "Scripting.FileSystemObject"; chr$(34); ")" print #1, "Set f = fso.OpenTextFile(WScript.Arguments.Item(0),1,true)" print #1, "Do While f.AtEndOfStream <> True" print #1, "MyVoice.Speak f.ReadLine" print #1, "Loop" print #1, "f.close" close #1 open "speak.txt" for output as #2 print #2, "The cow jumped over the moon." print #2, "Hello, World. I'm a speech object." close #2 a$ = "speak.txt" b$ = "cscript.exe speak.vbs "; a$ run b$, hide







Reply With Quote