----- Original Message -----
From: "Jon Bjornstad" <[EMAIL PROTECTED]>
To: "Jan Dubois" <[EMAIL PROTECTED]>
Cc: "'Sisyphus'" <[EMAIL PROTECTED]>;
<[email protected]>
Sent: Tuesday, June 14, 2005 1:13 PM
Subject: Re: Win32:OLE - Speech.VoiceText
> Sisyphus, Jan, all,
>
> Right. I'm sitting here copying code between an un-networked Win98
> laptop,
> an XP machine and my Apple iBook and apologize for the sloppy copying.
>
> This code does work on Win98 (with the Speech SDK installed)
> and Win2000 (stock) but not on XP:
>
> use Win::OLE;
> my $voice = Win32::OLE->new('Speech.VoiceText');
> die "no voice: $!\n" unless $voice;
> $voice->Register('', 'Perl');
> while (<STDIN>) {
> $voice->Speak($_, 0);
> }
>
> On XP it dies with "no voice:" and nothing in $!.
>
It's working for me now on Windows 2000. I don't think I can help with the
XP issue so I'll leave that to the experts, but you really should 'use
warnings;' - especially if a script is not running as you would like. That
will often give you a clue to the source of the problem (though I don't
think it will help in this particular instance).
As well as looking at $!, you might also try looking at
Win32::FormatMessage(Win32::GetLastError()), as that often gives much a
better indication of the problem where windows processes are involved. (You
have to 'use Win32;' to do that.)
One other thing I noticed is that if vcmd.exe is already running, you don't
have to '<STDIN>'. The script can exit immediately and the speech will
continue. But if the script is going to start up vcmd.exe (and kill it on
exit) then obviously the script cannot exit until the speech has finished. I
used sleep(2) instead of '<STDIN>'. Using '<STDIN>' I had to exit with
Ctrl-C, and then vcmd.exe is not closed (you can still see it as a running
process in Task Manager).
Cheers,
Rob
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs