WeatherInfo.txt

From XAP Automation
Revision as of 08:53, 13 October 2006 by Lehane (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Sub Main() set shell = createobject("wscript.shell") sTZInfoKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\" sActiveTimeBias = "ActiveTimeBias" nActiveTimeBias = shell.regread(sTZInfoKey & sActiveTimeBias) ' ' Have local offset from GMT/UTC in nActiveTimeBias ' ' Get reading from xAPWeather for local station ' CurrTemp=xap.getfromraw(rawmessage, "Weather.Report,tempc") ReportTime=xap.getfromraw(rawmessage, "Weather.Report,utc") ReportDate=xap.getfromraw(rawmessage, "Weather.Report,date") ' 'Check following line for all locales 'YMMV ' t=Mid(ReportDate,5,2)&"/"&Mid(ReportDate,7,2)&"/"&Left(ReportDate,4)&" " & ReportTime&":00" if IsDate(t) then tv=CDate(t) td=DateDiff("n",tv,Now())+nActiveTimeBias else td=99999 end if if ((td > 140) or (CurrTemp="unknown")) then ' ' Update values displayed on Floorplan ' Change for your specific weather station - EGVP here ' xap.SetDisplayValue "mi4.Weather.egvp", "Report Stale" SetGlobal "ReportedExternalTemp", -999 else xap.SetDisplayValue "mi4.Weather.egvp", "Outside "& CurrTemp & "C" SetGlobal "ReportedExternalTemp", CurrTemp ' ' You may want to add other code here ' end if set shell=nothing End Sub