<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: ole code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 21:49:35 GMT</pubDate>
    <description>DZone Snippets: ole code</description>
    <item>
      <title>Interactive Text-to-Speech (Windows, Perl)</title>
      <link>http://snippets.dzone.com/posts/show/5047</link>
      <description>This script calls the Windows OLE for the built in TTS. Type what you want the computer to say at the prompt and hit enter. To quit type ":q" (minus the quotation marks).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;use Win32::OLE qw( EVENTS );&lt;br /&gt;&lt;br /&gt;get_text();&lt;br /&gt;&lt;br /&gt;sub get_text{&lt;br /&gt;	$output_speech = &lt;STDIN&gt;;&lt;br /&gt;	chomp($output_speech);&lt;br /&gt;	if($output_speech ne ":q"){&lt;br /&gt;		say_this();&lt;br /&gt;		get_text();&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;sub say_this{&lt;br /&gt;	my $myTTS = new Win32::OLE( "Sapi.SpVoice" ); &lt;br /&gt;	$myTTS-&gt;Speak( "$output_speech" );&lt;br /&gt;	while( $myTTS-&gt;{Speaking} )&lt;br /&gt;	{&lt;br /&gt;		Win32::OLE-&gt;SpinMessageLoop();&lt;br /&gt;		Win32::Sleep( 100 );&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 28 Jan 2008 19:59:29 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5047</guid>
      <author>minitotoro (Natalie)</author>
    </item>
  </channel>
</rss>
