Guest User

Untitled

a guest
Feb 21st, 2017
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Say-Text {
  2.     param ([Parameter(Mandatory=$true, ValueFromPipeline=$true)] [string] $Text)
  3.     [Reflection.Assembly]::LoadWithPartialName('System.Speech') | Out-Null  
  4.     $object = New-Object System.Speech.Synthesis.SpeechSynthesizer
  5.     $object.Speak($Text)}
  6. Invoke-WebRequest -uri 'http://w1.weather.gov/xml/current_obs/KOLM.xml' -OutFile C:\scripts\connectfeed.xml
  7. [xml]$content = Get-Content C:\Scripts\ConnectFeed.xml
  8. $date = Get-Date
  9. $location = $content.DocumentElement.location.split(',')[0]
  10. $temperature = $content.DocumentElement.temp_f.split('.')[0]
  11. $weather = $content.DocumentElement.weather
  12. $windspeed = $content.DocumentElement.wind_mph
  13. $winddir = $content.DocumentElement.wind_dir
  14. say-text "Good Morning, it is $date in $location the current weather condition is $weather, the Temperature is $temperature degrees farenheit, the wind is blowing at $windspeed Miles Per hour with the direction $winddir"
Advertisement
Add Comment
Please, Sign In to add comment