Sure, systemdm, I'll post it.
In order to use this program you will have to go to
www.webscrape.com and download a small program called Pagescrape. That is what connects to the web page with the current temp. It is a screen scraping program that allows the use of regular expressions to retrieve only the data that you want to collect. It has several examples on this page of pscrape command lines that you can use. Unfortunately, several of the web pages have changed, so pscrape errors out on several of the examples. I have a long way to go to master regular expressions but this one works for my town.
Hpe you can get some good out of it.
'Program to connect to weather web page, retrieve current temp, write it to a temp file
'then send output to Windows text-to-speech engine to read it back to you and then delete temp file.
Option Explicit
Const SVSFlagsAsync = 1
const SVSFPurgeBeforeSpeak = 2
Dim Speech
Dim FSO
Dim shell
Dim filename
Dim run
Dim sText
CreateObjects
Announce_temp
DestroyObjects
Quit
Sub Announce_temp()
' Create the objects we need
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
' Generate Temp Filename which PageScrape will output to
fileName = fso.GetTempName
' Build command, in a VBS string literal, " must be escaped as ""
' The -o option tells PageScrape to write the matched text to a file
run = "pscrape -u""
http://www.city-data.com/forecast/w-Knoxville-Iowa.html"" -e""Temperature:(<.*>)*[^<]*(\d+)\D"" -b2 -f""Current Temperature in Knoxville is \$2 degrees"" -o""" & fileName & """"
' Run PageScrape synchronously in a hidden window
' The 0 specifies that the Window should be hidden
' The 1 specifies that we should wait for the command to complete
' before continuing
shell.Run run, 0, 1
' Open the Temp File and read its contents
stext = fso.OpenTextFile(fileName, 1).ReadAll
' Delete the Temp file
fso.DeleteFile filename
SpeakText sText
End Sub
Sub SpeakText(sText)
On Error Resume Next
Speech.Speak sText, SVSFlagsAsync + SVSFPurgeBeforeSpeak
Do
Sleep 100
Loop Until Speech.WaitUntilDone(10)
End Sub
Sub StopSpeaking()
On Error Resume Next
Speech.Speak vbNullString, SVSFPurgeBeforeSpeak
Set Speech = Nothing
End Sub
Sub CreateObjects
Set Speech = CreateObject("SAPI.SpVoice")
Set FSO = CreateObject("Scripting.FileSystemObject")
End Sub
Sub DestroyObjects
Set Speech = Nothing
Set FSO = Nothing
End Sub
Sub Sleep(nTimeout)
WScript.Sleep nTimeout
End Sub
Sub Quit
WScript.Quit
End Sub