Modules/Speaker/speaker.psm1
<# .SYNOPSIS Changes text to speech. .DESCRIPTION Speaks the text specified in the parameter aloud. .EXAMPLE Use-Speech "hello" #> function Use-Speech { [CmdletBinding(HelpUri="https://github.com/akotu235/APS/blob/master/Docs/Modules/Speaker/Use-Speech.md")] Param( [Parameter(Mandatory=$true, ValuefromPipeline=$true)] [System.String[]]$TextToSpeech ) Process{ if($input){ $Text += $_.ToString() } else{ $Text = $TextToSpeech } } End{ Start-Job { $sc = New-Object -ComObject MSScriptControl.ScriptControl.1 $sc.Language = 'VBScript' $sc.AddCode(' Function Speech(byval t) Set objVoice = CreateObject ("SAPI.SpVoice") ObjVoice.speak t End Function ') $sc.codeobject.Speech("$args") } -ArgumentList $Text -RunAs32 | Wait-Job | Receive-Job } } # SIG # Begin signature block # MIIIWAYJKoZIhvcNAQcCoIIISTCCCEUCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR # AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUnmmYBIVaTUn6o+/O6FaKdZDk # Tn+gggT6MIIE9jCCAt6gAwIBAgIQYYPyfUBBC6pE/rAfOslXOzANBgkqhkiG9w0B # AQsFADATMREwDwYDVQQDDAhha290dSBDQTAeFw0yMjA5MjAxOTQ4MDFaFw0zMjA5 # MjAxOTU4MDFaMBMxETAPBgNVBAMMCGFrb3R1IENBMIICIjANBgkqhkiG9w0BAQEF # AAOCAg8AMIICCgKCAgEAvGcae/FCZugTbghxO7Qv9wQKvRvp9/WvJyJci/SIsPr1 # /Mf5wfBTJ3aCvyjFvHfcsDH4NdHZubHO531tc1NHCDh+Ztkr5hbOdl3x46nEXm6u # e4Fiw23SB02dU3dAnFvNSGEE5jhQDOApGX/u7xEW4ZXrvMC5yLCBa3Kva1abPx5b # owvQlHhiSsn039/K2xSNhR+x4QcgEIo9JYdcob0f7ZY3AhXT+f1PNyYe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fFDbeWectIOvyaOr # Admdbw/12NstTP6Ts+RP8xoRj9Qmn70CYralSoCN6YaeqEpCFFBgvrr31fCqPOVQ # wXaLDGWfbbX7aLkXkM4oTjcM2yT5cVsJQ2WCUw== # SIG # End signature block |