The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Uk Weather Script


  • To: "HA (E-mail)" <ukha_d@xxxxxxx>
  • Subject: Uk Weather Script
  • From: Pedro de Oliveira <oliveirp@xxxxxxx>
  • Date: Sat, 14 Jul 2001 15:11:44 +0100
  • Delivered-to: rich@xxxxxxx
  • Delivered-to: mailing list ukha_d@xxxxxxx
  • Mailing-list: list ukha_d@xxxxxxx; contact ukha_d-owner@xxxxxxx
  • Reply-to: ukha_d@xxxxxxx

It should be setup for Brum as that is where I live

>  <<yahooweather.txt>>
Pedro



____________________________________
Automated Home UK
http://www.automatedhome.co.uk
____________________________________

Your use of Yahoo! Groups is subject t  http://docs.yahoo.com/info/terms/

sub main

host = "weather.yahoo.com"
page = "/forecast/Birmingham_UK_c.html"
' put your city in instead of Birmingham (check on the weather.yahoo.com
site for corect syntax, Farenheit or centigrade can be used by replacing
the *C.html for *f.html)
strip_tags = true
port = 80


Webpage = hs.GetURL(host, page, strip_tags, port)


'Temperature
position0 = InStr(1, Webpage, "Currently:",0)
temp = Mid (Webpage, position0+10 ,2)
temp = Replace (temp, chr(10), "",1,-1,1)
temp = trim(temp)
'hs.speak temp

'Clouds
position1 = InStr(position0, Webpage, ";C",0)
position2 = InStr(position0, Webpage, "Hi:",0)
length = position2 - position1
Clouds = Mid (Webpage, position1+2 ,length-2)
Clouds = Replace (Clouds, chr(10), "",1,-1,1)
Clouds = trim(Clouds)
'hs.speak Clouds


'Hi
position3 = InStr(1, Webpage, "Hi:;",0)
Hi = Mid (Webpage, position3+4 ,2)
Hi = Replace (Hi, chr(10), "",1,-1,1)
Hi = trim(Hi)
'hs.speak Hi



'Lo
position4 = InStr(1, Webpage, "Lo:;",0)
Lo = Mid (Webpage, position4+4 ,2)
Lo = Replace (Lo, chr(10), "",1,-1,1)
Lo = trim(Lo)
'hs.speak Lo



'Apparent Temp
position5 = InStr(position0, Webpage, "Appar Temp:",0)
position6 = InStr(position0, Webpage, "Dewpoint:",0)
length = position6 - position5
Atemp = Mid (Webpage, position5+11 ,length-15)
Atemp = Replace (Atemp, chr(10), "",1,-1,1)
Atemp = trim(Atemp)
'hs.speak Atemp




'Dewpoint
position7 = InStr(position0, Webpage, "Dewpoint:",0)
position8 = InStr(position0, Webpage, "Barometer:",0)
length = position8 - position7
Dew = Mid (Webpage, position7+10 ,length-16)
Dew = Replace (Dew, chr(10), "",1,-1,1)
Dew = trim(Dew)
'hs.speak Dew



'Barometer
position9 = InStr(position0, Webpage, "Barometer:",0)
position10 = InStr(position0, Webpage, "mb",0)
length = position10 - position9
Bar = Mid (Webpage, position9+10 ,length-14)
Bar = Replace (Bar, chr(10), "",1,-1,1)
Bar = trim(Bar)
'hs.speak Bar



'Wind direction
position11 = InStr(position0, Webpage, "Wind:",0)
position12 = InStr(position0, Webpage, "km/h",0)
length = position12 - position11
WD = Mid (Webpage, position11+5 ,length-9)
WD = Replace (WD, chr(10), "",1,-1,1)
WD = trim(WD)
'hs.speak WD



'Wind Speed
position13 = InStr(position11, Webpage, "/",0)
position14 = InStr(position0, Webpage, "km/h",0)
length = position14 - position13
WS = Mid (Webpage, position13+1 ,length-2)
WS = Replace (WS, chr(10), "",1,-1,1)
WS = trim(WS)
'hs.speak WS



'Humidity
position15 = InStr(position11, Webpage, "Humidity:",0)
position16 = InStr(position0, Webpage, "Visibility:",0)
length = position16 - position15
H = Mid (Webpage, position15+9 ,length-11)
H = Replace (H, chr(10), "",1,-1,1)
H = trim(H)
'hs.speak H



'Visibility
position17 = InStr(position11, Webpage, "Visibility:",0)
position18 = InStr(position0, Webpage, "Records",0)
length = position16 - position15
V = Mid (Webpage, position17+11 ,length-14)
V = Replace (V, chr(10), "",1,-1,1)
V = trim(V)
'hs.speak V




'Now lets put it all together
hs.speak "Birmingham is currently under " & Clouds &
" skies.  The temperature is " & temp & " degrees C 
 but feels like " & Atemp & " because of the " &
WS & " kilometer per hour " & WD & " wind.   
Humidity is " & H & " , pressure is " & Bar
& " millibars and the visibility is " & V & "
kilometers."

end sub

Home | Main Index | Thread Index

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.