Octavian - The script below still has the error that I originally introduced.
It should be $voice->Speak("hello world", 0);

Thanks to Jan for the research!
So now I can code like this:

use Win32;
my $speech_object = (Win32::GetOSName() =~ /XP/)?
            "SAPI.SpVoice": "Speech.VoiceText";
use Win32::OLE;
my $voice = Win32::OLE->new($speech_object);

and all will be well.

Thanks a Million!
Jon

On Jun 13, 2005, at 11:27 PM, Octavian Rasnita wrote:

I have also tried the following script under Windows 2000 but it doesn't
work and it doesn't give any error.
The SAPI 4 is installed by default in Windows 2000 and it works fine with
Narrator and with my screen reader so this is not a problem.

Under Windows XP SAPI 5 is installed by default, and it might have a little
different syntax...

But I am wondering why this script doesn't work...



use strict;
use warnings;

use Win32::OLE;
my $voice = Win32::OLE->new("Speech.VoiceText");
$voice->Register('', 'Perl');
$voice->speak("hello world");
<STDIN>;        # wait til it finishes speaking

----- Original Message -----
From: "Sisyphus" <[EMAIL PROTECTED]>
To: <[email protected]>; "Jon Bjornstad"
<[EMAIL PROTECTED]>
Sent: Tuesday, June 14, 2005 4:30 AM
Subject: Re: Win32:OLE - Speech.VoiceText




----- Original Message -----
From: "Jon Bjornstad" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 14, 2005 9:26 AM
Subject: Win32:OLE - Speech.VoiceText



This code:

use Win32::Ole;
my $voice = Win32::Ole->new("Speech.VoiceText");
$voice->Register('', 'Perl');
$voice->speak("hello world");
<STDIN>;        # wait til it finishes speaking

has been used succesfully on Windows98 (with the
Microsoft Speech SDK installed) and on Windows 2000
(which has it installed by default, apparently).



Doesn't work for me on Windows 2000. Even after I correct the typos (both instances of "Ole" need to be replaced with "OLE") and 'use warnings;' all

I

get is:

Win32::OLE(0.1502) error 0x8002000e: "Invalid number of parameters"
    in METHOD/PROPERTYGET "speak" at speak.pl line 5

Does 'use warnings;' result in the same warning on XP ?

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs





_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to