Forum: Ruby need help with win32-sapi

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
73700e119917433681f2e8f3e4369f74?d=identicon&s=25 Li CN (alex-osu3)
on 2008-10-10 16:25
Hi all,

I try to do some 'text to speach' stuff using win32-sapi.

I run the example from the rdoc but I get the error info. I wonder how
to fix it.

Thanks,

Li



C:\Users\Alex>irb
irb(main):001:0> require 'win32/sapi5'
=> true
irb(main):002:0>    include Win32
=> Object
irb(main):003:0>
irb(main):004:0*    v = SpVoice.new
=> #<Win32::SpVoice:0x337212c>
irb(main):005:0>    v.Speak("Shall we play a game?")
WIN32OLERuntimeError: Speak
    OLE error code:80040154 in <Unknown>
      <No Description>
    HRESULT error code:0x80020009
      Exception occurred.
        from (irb):5:in `method_missing'
        from (irb):5
irb(main):006:0>
73700e119917433681f2e8f3e4369f74?d=identicon&s=25 Li CN (alex-osu3)
on 2008-10-14 17:05
Li Chen wrote:
> Hi all,
>
> I try to do some 'text to speach' stuff using win32-sapi.
>
> I run the example from the rdoc but I get the error info. I wonder how
> to fix it.
>
> Thanks,
>
> Li
>
>
>
> C:\Users\Alex>irb
> irb(main):001:0> require 'win32/sapi5'
> => true
> irb(main):002:0>    include Win32
> => Object
> irb(main):003:0>
> irb(main):004:0*    v = SpVoice.new
> => #<Win32::SpVoice:0x337212c>
> irb(main):005:0>    v.Speak("Shall we play a game?")
> WIN32OLERuntimeError: Speak
>     OLE error code:80040154 in <Unknown>
>       <No Description>
>     HRESULT error code:0x80020009
>       Exception occurred.
>         from (irb):5:in `method_missing'
>         from (irb):5
> irb(main):006:0>


Hi all,

I solve this problem by myself as following(it crosses my mind when I
read other articles on the internet):

Start>control panel>Speech on Xp or(text to speech on vista)>Voice
selection>apply

Then run the script above and it works!!! I guess I don't set up the
voice correctly at the beginning.

Li
This topic is locked and can not be replied to.