Results 1 to 4 of 4

Thread: [RESOLVED] Help with a Speech Object

Threaded View

  1. #1

    Thread Starter
    Lively Member Brian M.'s Avatar
    Join Date
    Nov 2006
    Location
    Moberly MO
    Posts
    94

    Resolved [RESOLVED] Help with a Speech Object

    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
    Last edited by Brian M.; Jul 17th, 2008 at 11:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width