<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>API Programming &#187; Downloads</title>
	<atom:link href="http://www.brangle.com/wordpress/tag/downloads/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brangle.com/wordpress</link>
	<description>Just another computer weblog</description>
	<lastBuildDate>Tue, 08 Sep 2009 05:41:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Make Your Computer Talk with VB.NET Application (and Source Code)</title>
		<link>http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-application-and-source-code/</link>
		<comments>http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-application-and-source-code/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 02:57:25 +0000</pubDate>
		<dc:creator>lopezg</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.brangle.com/wordpress/?p=502</guid>
		<description><![CDATA[I was playing around with COM objects in Windows and discovered that I could access the SAPI.SpVoice interface and make Microsoft Windows talk to me.  Well needless to say I had to rush and develop and application to do just that.  I uploaded a simple applicaton which will just say whatever you type in as an argument.  For example <i>SpeakToMeConsole.exe Hello World</i> will make your computer speak the words "Hello World."  The part that really amazes me is that the guts of this program is only 2 lines long, and it can even that can reduced down to 1 line if we create an anonymous instance of SAPI.SpVoice object.]]></description>
			<content:encoded><![CDATA[<p>I was playing around with COM objects in Windows and discovered that I could access the SAPI.SpVoice interface and make Microsoft Windows talk to me.  Well needless to say I had to rush and develop and application to do just that.  I uploaded a simple applicaton which will just say whatever you type in as an argument.  For example <i>SpeakToMeConsole.exe Hello World</i> will make your computer speak the words &#8220;Hello World.&#8221;  The part that really amazes me is that the guts of this program is only 2 lines long, and it can even that can reduced down to 1 line if we create an anonymous instance of SAPI.SpVoice object.<span id="more-502"></span></p>
<p>The reason I created it as a console application and not a windows app is because I envisioned this program only really only having a valid function when it&#8217;s called from another application. Or even better, you want to spook your girlfriend or parents by making their laptop talk to them when it turns on!  Whatever your reasons are, enjoy! Oh and let me know how you use this program in the comments.</p>
<div id="attachment_506" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.brangle.com/downloads/SpeakToMe/v1.0/SpeakToMeConsole.exe"><img src="http://www.brangle.com/wordpress/wp-content/uploads/2009/08/download-button.jpg" alt="Download SpeakToMe App" title="Download SpeakToMe App" width="150" height="144" class="size-full wp-image-506" /></a><p class="wp-caption-text">Download SpeakToMe App</p></div>
<p>Here is the complete source code to the above application. Let me know what you think in the comments!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">'This application was developed by Gerardo Lopez and was downloaded from www.brangle.com</span>
<span style="color: #008080; font-style: italic;">'Complete source code is available at:</span>
<span style="color: #008080; font-style: italic;">'http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-app-source-code/</span>
&nbsp;
&nbsp;
Module Module1
    <span style="color: #008080; font-style: italic;">'We want to make sure we grab any arguments as args so that we speak them    </span>
    <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> args <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #008080; font-style: italic;">'If there are no arguments UBound will return -1</span>
        <span style="color: #008080; font-style: italic;">'Therefore we want to make sure to let the user know how to run the app if </span>
        <span style="color: #008080; font-style: italic;">'they don't enter any arguments</span>
        <span style="color: #0600FF;">If</span> <span style="color: #0600FF;">UBound</span><span style="color: #000000;">&#40;</span>args<span style="color: #000000;">&#41;</span> &gt; <span style="color: #008000;">-</span><span style="color: #FF0000;">1</span> <span style="color: #FF8000;">Then</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">'Generate an empty string, we'll use this to concatenate all of our arguments </span>
            <span style="color: #008080; font-style: italic;">'together so we can pass it to the narrator</span>
            <span style="color: #0600FF;">Dim</span> <span style="color: #FF8000;">input</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;&quot;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">'Concat all of our arguments together and make sure to put a space in </span>
            <span style="color: #008080; font-style: italic;">'between them so the words don't run together</span>
            <span style="color: #FF8000;">For</span> <span style="color: #0600FF;">Each</span> arg <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> In args
                <span style="color: #FF8000;">input</span> <span style="color: #008000;">=</span> <span style="color: #FF8000;">input</span> <span style="color: #008000;">+</span> arg <span style="color: #008000;">+</span> <span style="color: #808080;">&quot; &quot;</span>
            <span style="color: #FF8000;">Next</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">'Create an object and gain access to the narrator</span>
            <span style="color: #0600FF;">Dim</span> voice <span style="color: #008000;">=</span> <span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;SAPI.SpVoice&quot;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #008080; font-style: italic;">'Tells the narrator what to say</span>
            voice.<span style="color: #0000FF;">Speak</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">input</span><span style="color: #000000;">&#41;</span>
        <span style="color: #FF8000;">Else</span>
            <span style="color: #008080; font-style: italic;">'The is where we tell the user what to say if they didn't enter any arguments</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;No arguments specified&quot;</span><span style="color: #000000;">&#41;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Try this instead: SpeakToMe.exe Hello World&quot;</span><span style="color: #000000;">&#41;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>vbCrLf <span style="color: #008000;">+</span> vbCrLf <span style="color: #008000;">+</span> <span style="color: #808080;">&quot;Visit www.brangle.com for other apps&quot;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
<span style="color: #0600FF;">End</span> Module
<span style="color: #008080; font-style: italic;">'The End</span></pre></td></tr></table></div>

<p>To run this program from the command line, you can type in something like the following:</p>
<pre>SpeakToMeConsole.exe Hello World</pre>
<p>And here is the beautiful one-liner!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0600FF;">CreateObject</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;SAPI.SpVoice&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Speak</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;hello from brangle.com&quot;</span><span style="color: #000000;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.brangle.com/wordpress/2009/08/make-your-computer-talk-with-vb-net-application-and-source-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
