[Script] Alerting on web info

Forum over Homeseer scripts (DUTCH forum)

Moderators: TANE, Ruud

Post Reply
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

[Script] Alerting on web info

Post 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
User avatar
Noel
Senior Member
Senior Member
Posts: 1887
Joined: Tue Feb 12, 2008 12:13 am
Location: Netherlands
Contact:

[Script] Alerting on web info

Post by Noel »

Nice one.

--
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

[Script] Alerting on web info

Post by drmacchi »

Just because i'm not a programmer, but with your script you can find a text in ANY webpage anywhere? thanks
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

[Script] Alerting on web info

Post 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)
Post Reply

Return to “Homeseer Scripts Forum”