' In Shell command, type in "CurrentWeather [get_WOEID] [get_Temperature]" to execute this script.

    Dim woeid
    Dim unit
    
    Set args = Wscript.Arguments
    'MsgBox WScript.Arguments.Count
    If (Wscript.Arguments.Count=2) Then
        woeid = args(0)
        unit = args(1)
    Else
    ' Enter the woeid code here
    '-------------------------
    woeid = "55921389"

    ' Enter the temperature unit here c = Centigrade or f =  fahrenheit
    '-------------------------
    unit = "c"
    'end of user editable settings
    '------------------------------------------------------------------------------------
    End If
    
    
    Set FSO = CreateObject("Scripting.FileSystemObject")
    Set wshShell = CreateObject("WScript.Shell")
    Set o = CreateObject("MSXML2.XMLHTTP")
    ' Initialize tts
    Set sapi = CreateObject("sapi.spvoice")
    'GetRemoteBinaryFile.vbs
    Set TmpFolder = FSO.GetSpecialFolder(2)
    ImageFile = "TempOutput.xml"
    DestFolder = "C:\Temp\"
    'DestFolder = TmpFolder
    URL = "http://weather.yahooapis.com/forecastrss?w=" & woeid & "&u=" & unit
    Set xml = CreateObject("Microsoft.XMLHTTP")
    xml.open "GET", URL, False
    xml.Send
    Set oStream = CreateObject("Adodb.Stream")

    Const adTypeBinary = 1
    Const adSaveCreateOverWrite = 2
    Const adSaveCreateNotExist = 1

    oStream.Type = adTypeBinary
    oStream.open
    oStream.write xml.responseBody
    ' Do not overwrite an existing file
    oStream.SaveToFile DestFolder & ImageFile, adSaveCreateOverWrite
    ' Use this form to overwrite a file if it already exists
    oStream.SaveToFile DestFolder & ImageFile, adSaveCreateOverWrite
    oStream.Close
    Set oStream = Nothing
    Set xml = Nothing
    Set xmlDoc = CreateObject("Msxml2.DOMDocument")
    xmlDoc.async = "false"
    xmlDoc.Load (DestFolder & ImageFile)

    Dim objElem 'As MSXML.IXMLDOMElement
    Dim DescElem ' As MSXML.IXMLDOMElement
    Dim objNodeList 'As MSXML.IXMLDOMNodeList

    TownName = xmlDoc.SelectSingleNode("//rss//channel/yweather:location").GetAttribute("city")
    Sunrise = xmlDoc.SelectSingleNode("//rss//channel/yweather:astronomy").GetAttribute("sunrise")
    Sunset = xmlDoc.SelectSingleNode("//rss//channel/yweather:astronomy").GetAttribute("sunset")
    CurrentTemp = xmlDoc.SelectSingleNode("//rss//channel/item/yweather:condition").GetAttribute("temp")
    CurrentCondition = xmlDoc.SelectSingleNode("//rss//channel/item/yweather:condition").GetAttribute("text")
    SunriseTime = TimeValue(Sunrise)
    SunsetTime = TimeValue(Sunset)

    'Delete temporary output.xml file created because it is no longer needed
    'FSO.DeleteFile (DestFolder & ImageFile)
    If unit = "c" Then
        UnitText = " Celcius"
    Else
        UnitText = "  Fahrenheit"
    End If

    sapi.speak "The current conditions for " & TownName & " is " & CurrentCondition & " with a temperature of " & CurrentTemp & " Degrees " & UnitText

    If SunriseTime < Now() Then
        sapi.speak "Sunrise was at " & Sunrise
    Else
        sapi.speak "Sunrise is at " & Sunrise
    End If

    If SunsetTime < Now() Then
        sapi.speak "Sunset was at " & Sunset
    Else
        sapi.speak "Sunrise is at " & Sunset
    End If