I couldn't get any events to be fired either. Perhaps Jan can weigh in since
he seems to be around today.

Here's my test code:

use strict;
use Win32::OLE qw(EVENTS);

my $vox = Win32::OLE->new ('SAPI.SpVoice')
  || die "Unable to create SAPI object\n";

sub Event {
  my ($Obj, $Event, @Args) = @_;
  print "Event: $Event\n";
}

Win32::OLE->WithEvents ($vox, \&Event);
$vox->{'EventInterests'} = 32; #Fire only new word events

my $text = "This is the Microsoft Speech Library.";

$vox->Speak ($text, 1); #Read text asynchronously

Win32::OLE->MessageLoop ();

-----Original Message-----
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
haratron
Sent: Monday, March 19, 2012 1:54 PM
To: Howard Tanner
Cc: perl-win32-users@listserv.activestate.com
Subject: Re: Win32::OLE events callback not executed

Thanks for the answer.

I've also found these links that can help maybe:
http://code.activestate.com/lists/activeperl/13161/  <-- tried it, callback
still doesn't get executed
http://www.perlmonks.org/?node_id=429272 <-- tried it, doesn't work

I'm finding it difficult to translate that VB code to Perl.
If anyone can help, much appreciated.


On Mon, Mar 19, 2012 at 7:01 PM, Howard Tanner <tan...@optonline.net> wrote:
> From: perl-win32-users-boun...@listserv.activestate.com
> [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf 
> Of haratron
> Sent: Monday, March 19, 2012 11:21 AM
> To: perl-win32-users@listserv.ActiveState.com
> Subject: Win32::OLE events callback not executed
>
> Hello,
>
> I want to implement "karaoke" functionality on my TTS (text to speech) 
> editor. Meaning that I want to highlight words the moment they are 
> spoken by the TTS system.
>
> I read that I need to watch for the onWord event.
>
> I have the same problem with this person:
> http://www.mail-archive.com/perl-win32-users@listserv.activestate.com/
> msg275
> 30.html
>
> The callback never gets executed.
>
> How can I fix this?
>
> Thank you,
> haratron
> _______________________________________________
>
> Here's the dox from M$ on the Word event:
>
> http://msdn.microsoft.com/en-us/library/ms723593(v=vs.85).aspx
>
> It includes a VB example that does exactly what you want. Perhaps 
> someone here better at Perl than me can help you translate it.
>
> I don't know where Mr. "James Brown" got his ordinal from, but I 
> suspect the number "32", if that's correct at all, will be O/S version 
> dependent, since different versions of Windows have slightly different
versions of SAPI.
> Perhaps there's a better way in Perl to trap the Word event than using 
> the ordinal. And note that the event is Word, not onWord.
>
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to