[Date Prev][Date
Next][Thread Prev][Thread Next][Date
Index][Thread Index]
RE: [OT] Grabbing the lottery results
- To: <ukha_d@xxxxxxx>
- Subject: RE: [OT] Grabbing the lottery results
- From: "Justin" <justin@xxxxxxx>
- Date: Tue, 7 Oct 2003 20:02:54 +0100
- Mailing-list: list ukha_d@xxxxxxx; contact
ukha_d-owner@xxxxxxx
- Reply-to: ukha_d@xxxxxxx
Here is a HomeSeer script. It's not very elegant, but it works!
Justin.
'*****************************************************
'Lottery Numbers script by Justin Earl - www.gadgetjunkie.net
'ver 1.0
'You must first create a virtual device in HomeSeer then
'change the relevant section in the script below
sub main()
'*******************************************************
'******Change this variable to reflect your setup*******
'*******************************************************
'The device which you wish to update with your stats
MyVirtualDevice =3D "v30"
'*******************************************************
LogToFile =3D false 'Set this to true for debugging
host =3D "http://www.national-lottery.co.uk"
page =3D "/player/p/home/home.do"
strip_tags =3D false
port =3D 80
Webpage =3D hs.GetURL(host, page, strip_tags, port)
webpage =3D replace(webpage,Chr(10),"")
webpage =3D replace(webpage,Chr(13),"")
If webpage =3D "" then
hs.writelog "Info","Error gathering Seti stats from: "
& host
Exit Sub
End If
If LogToFile =3D True then
Set Folder =3D CreateObject("Scripting.FileSystemObject")
Set TextStream =3D Folder.CreateTextFile(hs.getapppath &
"\lottery.txt",
True)
TextStream.Write webpage
TextStream.Close
set folder =3D nothing
set textstream =3D nothing
End If
' Draw Date
a =3D instr(webpage,"LATEST RESULTS")+14
b =3D instr(a,webpage,"Draw")
c =3D instr(b,webpage,"<BR>")
d =3D (c-b)
e =3D mid(webpage,b,d)
DrawDate =3D e
' First Number
a =3D instr(webpage,"Ball number ")+12
b =3D instr(a,webpage," /><img")-1
c =3D (b-a)
d =3D mid(webpage,a,c)
Num1 =3D trim(d) & " "
' Second Number
a =3D instr(b,webpage,"Ball number ")+12
b =3D instr(a,webpage," /><img")-1
c =3D (b-a)
d =3D mid(webpage,a,c)
Num2 =3D trim(d) & " "
' Third Number
a =3D instr(b,webpage,"Ball number ")+12
b =3D instr(a,webpage," /><img")-1
c =3D (b-a)
d =3D mid(webpage,a,c)
Num3 =3D trim(d) & " "
' Fourth Number
a =3D instr(b,webpage,"Ball number ")+12
b =3D instr(a,webpage," /><img")-1
c =3D (b-a)
d =3D mid(webpage,a,c)
Num4 =3D trim(d) & " "
' Fifth Number
a =3D instr(b,webpage,"Ball number ")+12
b =3D instr(a,webpage," /><img")-1
c =3D (b-a)
d =3D mid(webpage,a,c)
Num5 =3D trim(d) & " "
' Sixth Number
a =3D instr(b,webpage,"Ball number ")+12
b =3D instr(a,webpage," /><img")-1
c =3D (b-a)
d =3D mid(webpage,a,c)
Num6 =3D trim(d) & " "
' Bonus Ball Number
a =3D instr(b,webpage,"Ball number ")+12
b =3D instr(a,webpage," />")-1
c =3D (b-a)
d =3D mid(webpage,a,c)
Num7=3D "(" & trim(d) & ")"
LotteryNumbers =3D Drawdate & " - " & Num1 & Num2
& Num3 & Num4 & Num5 & Nu=
m6
& Num7
Msgbox LotteryNumbers
'hs.SetDeviceString MyVirtualDevice,"Lottery Results: " &
LotteryNumbers
End Sub
'*********************************************************************
> -----Original Message-----
> From: Alex Kinch [mailto:alex@xxxxxxx]
> Sent: 07 October 2003 4:37 PM
> To: ukha_d@xxxxxxx
> Subject: [ukha_d] [OT] Grabbing the lottery results
>
>
> Hi gang,
>
> OK so wayyy [OT], but has anyone got a script handy that grabs
> the lottery results from the BBC or Camelot's website?
Home |
Main Index |
Thread Index
|