::::::::: PowerShell :::::::::
Wednesday, November 09, 2005
  Speak, your mind... In Excel that is...
I think what i am posting is quite old of a stuff.
But oh well... Like I care...

Let excel "speak" what you type...

function speak {
param([string] $text = "Hello, World!")

$ex = new-object -com excel.application
$ex.speech.speak($text, $null, $null, $null)
}



now,


MSH> speak "your mind..."


Oh yeah, the problem is that, after each "speak", an instance of "excel" will be shown on your Task Manager. So if you would like to spam "speak", create an instance of excel object "outside" of function speak, then use that excel object repeately.

Bah, i am not sure how to dispose that $ex when it's out of scope of function speak yet. I thought it was gonna be done automatically... I guess i should mess around with scope, tomorrow...
 
Comments:
There is also a .NET object, and thomas had an Example on his site but that is not working for me also, so it's a not old one yet ;-)
but .NET 2.0 Speach (winFX) should be cool also.

gr /\/\o\/\/
 
PS, to hide the ExcelTab

$ex.ShowWindowsInTaskbar = $false

gr /\/\o\/\/
 
Thanks for that .Net 2.0 info. I appreciate it. I guess i won't have to use "excel"(i hated the dependancy on excel...) to actually make my computer speak any more :)

Oh yeah, for the second comment, it's just that I am not sure why "$ex" isn't disposed after it's out of scope of the function "speak"...
 
This crashes Excel 2007, and you have to kill PowerShell with CTRL+BREAK, ha (tested on 1.0 RC2).
 
Post a Comment



<< Home
Let's get lazy with PowerShell!

Name:
Location: Flushing, NY, United States

Experimenting with a different format of blogs...

Links
ARCHIVES
10/01/2005 - 11/01/2005 / 11/01/2005 - 12/01/2005 / 12/01/2005 - 01/01/2006 / 01/01/2006 - 02/01/2006 / 02/01/2006 - 03/01/2006 / 03/01/2006 - 04/01/2006 / 04/01/2006 - 05/01/2006 / 05/01/2006 - 06/01/2006 / 06/01/2006 - 07/01/2006 / 07/01/2006 - 08/01/2006 / 08/01/2006 - 09/01/2006 / 10/01/2006 - 11/01/2006 / 11/01/2006 - 12/01/2006 /


Powered by Blogger