Page 1 of 1

[Script] Alerting on web info

Posted: Fri Sep 04, 2009 8:24 pm
by AshaiRey
<b>The Problem</b>
I travel by train to work. However the train often don't run because of some defect. If this happens i have the choice of having 1h to 1.5h extra travel time or go back home (15Km) and work from home.

<b>Solution</b>
Just before i wake up HS will get the webpage and parse it for a keyword. If this keyword is found then take some actions to notify me.

Code: Select all

'Usage:
'
'get_html <URL>, <Text to search for>
'Example : Get_HTML "http://www.ns.nl/storingen/index.form", "storing rounded"
'
'Remark : Search text is not case sensitive



Public Sub Main(ByVal Parms As String)
	Get_HTML("http://www.ns.nl/storingen/index.form", "storing rounded")
End Sub



Sub Get_HTML (up_http, SearchString)
	dim xmlhttp 
	xmlhttp = createobject("msxml2.xmlhttp.3.0")
	xmlhttp.open("get", up_http, false)
	xmlhttp.send
	
	if(instr(Ucase(xmlhttp.responseText), Ucase(SearchString))) then DoActions()

	xmlhttp = nothing
End Sub



Sub DoActions()
	'<-- Do actions here -->
	'Turn ON the Audrey in the living room and OFF after 30 mins.
	hs.ExecX10("K6", "ON")
	hs.WaitSecs(120)
	hs.GetURL("192.168.55.51","/led.shtml?t2m2",TRUE,80)
	hs.WaitSecs(1800)
	hs.ExecX10("K6", "OFF")
	'<-- End of actions -->
End Sub

[Script] Alerting on web info

Posted: Sat Sep 05, 2009 8:25 am
by Noel
Nice one.

--

[Script] Alerting on web info

Posted: Mon Sep 07, 2009 2:54 pm
by drmacchi
Just because i'm not a programmer, but with your script you can find a text in ANY webpage anywhere? thanks

[Script] Alerting on web info

Posted: Tue Sep 08, 2009 11:31 am
by AshaiRey
Thanks.

Some other ideas to use this.

- News headlines
- Breaking News
- Weather warnings
- Discount warning
- Checking http enabled netwerk devices (think of webcams with a webserver in it)