[Message Prev][Message
Next][Thread Prev][Thread Next][Message
Index][Thread Index]
News Headline Script for xplhal
- Subject: News Headline Script for xplhal
- From: Tony T
- Date: Sun, 02 Mar 2003 09:58:00 +0000
Hi all,
This is a news headline script (based around a script by Amar Nagi) for
xPLHal that reads out the yahoo news headlines via xPL TTS messages. I've
added it to my wake up macro. I also have an xPL OSD version.
It requires the latest v3.01 version of xPLHal (just published) and an xPL
TTS app.
Though it could easily be modified for other vbscript ha systems.
sub HeadlinesTTS()
Dim sRawWeb, iPos1, iPos2, sPara, icnt
' announce
mymsg="SPEECH=Todays Headlines are;"
call xpl.sendmsg("","","TTS.BASIC",mymsg)
' Get the Webpage
sRawWeb = sys.gethttp("<a href="http://uk.yahoo.com/">http://uk.yahoo.com/</a>",40000,5)
if sRawWeb = "" then
mymsg="SPEECH=not available, sorry."
call xpl.sendmsg("","","TTS.BASIC",mymsg)
exit sub
end if
'Find the positions in Page
iPos1 = InStr(1, sRawWeb, "In The News", vbTextCompare)
iPos2 = InStr(iPos1, sRawWeb, "<tr><td colspan=2>",
vbTextCompare)
' Kill some ugly characters and replace with period
sPara = Replace(Mid(sRawWeb, iPos1, iPos2 - iPos1),
"&#149;;", ".")
'Split the String By Period into an array
snews = Split(sPara, "</a>", -1, 1)
' Walk through the array and speak the headlines
For icnt = 0 To UBound(snews) - 1
x = InStr(1, snews(icnt), ".html>", vbBinaryCompare)
if icnt=ubound(snews)-1 then
mymsg="SPEECH=and finally, " &
RTrim(LTrim(Mid(snews(icnt), x + 6))) & ";"
else
mymsg="SPEECH=" & RTrim(LTrim(Mid(snews(icnt), x +
6))) & ";"
end if
call xpl.sendmsg("","","TTS.BASIC",mymsg)
Next
End Sub
Regards
Tony
xPL Main Index |
xPL Thread Index |
xPL Home |
Archives Home
|