Weather

;
; Say time and weather autohotkey script
;Find your local XML feed from the following url and setup the urldownloadtofile to save to your Hardrive
;Where to find your local weather XML feed =  http://w1.weather.gov/xml/current_obs/seek.php?state=tn&Find=Find#XML

SetTimer, Killscript, -50000  ;Script will check weather every hour and announce time and weather conditions
{
Sleep 15000
}
UrlDownloadToFile, http://w1.weather.gov/xml/current_obs/KMEM.xml, C:\RadioDJ\Currentweather.CSV 
FileRead, xmldata, C:\RadioDJ\Currentweather.CSV 
doc := ComObjCreate(“MSXML2.DOMDocument.6.0”)
doc.async := false
doc.loadXML(xmldata)
DocNode := doc.selectSingleNode(“//current_observation/weather”)
weather := DocNode.text
DocNode := doc.selectSingleNode(“//current_observation/temp_f”)
temperature := DocNode.text
DocNode := doc.selectSingleNode(“//current_observation/relative_humidity”)
humidity := DocNode.text
DocNode := doc.selectSingleNode(“//current_observation/pressure_in”)
pressure_in := DocNode.text
DocNode := doc.selectSingleNode(“//current_observation/wind_dir”)
wind_dir := DocNode.text
DocNode := doc.selectSingleNode(“//current_observation/wind_mph”)
wind_mph := DocNode.text
Gui, Add, Button, r1 w970 , OK 
Gui, Show,x20 y2,*** %Weather% *** %temperature% Degrees *** %humidity% Percent Humidity *** Barometric Pressure %pressure_in% inches *** Wind from the %Wind_dir% At %Wind_mph% MPH

SayTime:
FormatTime, SayHour, %A_Now%, h ; get current hour
FormatTime, SayMinute, %A_Now%, m ; get current minutes
FormatTime, SayAMPM, %A_Now%, tt ; get AM/PM

If(SayMinute>0 && SayMinute<10) ; add the “oh” for minutes 1 through nine
SayMinute = oh %SayMinute%
If(SayMinute=0) ; if the current minute is 0, say oh clock instead of zero
SayMinute = oh clock
IfInString, SayAMPM, AM ; If AM, say a m instead of ameters
SayAMPM = A M
IfInString, SayAMPM, PM ; If PM, say p m instead of pmeters
SayAMPM = P M

SayTimeString = The time now is, %SayHour% %SayMinute% %SayAMPM% ,and the current weather, from the studios at, Alchemy Select Radio is, %Weather% with a Current Temperature of, %temperature% degrees Fahrenheit, Relative Humidity is, %humidity% percent, with a barometric pressure of, %pressure_in% inches, and , the Wind, is from the %Wind_Dir% , at %Wind_mph% miles per hour, This has been your local weather, five minutes of news is next ; announce weather once

v := ComObjCreate(“SAPI.SpVoice”)
v.Voice := v.GetVoices().Item( 17 ) ; set the voice  
v.rate := -1 ; slow down speak
v.volume := 100
v.Speak(SayTimeString)
sleep 5000
Return

ButtonOk:
ExitApp
return

KillScript:
sleep 5000
ExitApp



Current track

Title

Artist