Introduction
There are many programs to display headlines from websites but who needs another app burning up resources! You can read the headlines from Visual Studio with this handy macro. The fact that it looks like code helps too - easier to hide than a web browser at work. I joke.
Install the Macro
Copy the vsrdf.dsm file to C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Macros.
Run Visual Studio and go to the Tools menu and select Customize. In the dialog shown, select the 'Add ins and Macros' tab. Click Browse to select the vsrdf.dsm file. The macro file can be edited using the 'Macro' entry in the Tools menu. See MSDN for more info on VS macros.
Modify the Macro
Modify the websites as appropriate in the first sub. Assign the macro to a button and that's it. The tag removal code was found on Code Project. Have fun.
'--------------------------------------------------------------------
'FILE DESCRIPTION: Web Reader by Davy Mitchell www.latedecember.com
'--------------------------------------------------------------------
Sub GetHeadlines()
'DESCRIPTION: Grabs headlines and displays them as text.
Documents.Add "Text"
RDFText = GetHTML("http://christdot.org/backend.php")
ActiveDocument.Selection = ActiveDocument.Selection & stripHTML(RDFText)
RDFText = GetHTML("http://slashdot.org/slashdot.rdf")
ActiveDocument.Selection = ActiveDocument.Selection & stripHTML(RDFText)
'Store
ActiveDocument.Save("C:\news.cpp")
End Sub
Function GetHTML(strPage)
On Error Resume Next
Set objXMLHttp = CreateObject("Microsoft.XMLHTTP")
objXMLHttp.Open "GET", strPage, False, "", ""
objXMLHttp.Send
If Err.Number = 0 Then
If objXMLHttp.Status = 200 Then
GetHTML = objXMLHttp.ResponseText
Else
GetHTML = "Incorrect URL"
End If
Else
GetHTML = Err.Description
End If
Set objXMLHttp = Nothing
End Function
function stripHTML(strInput)
strInput = Replace(strInput, "<title>",vbCR + vbLF +"<title>")
strInput = Replace(strInput, "</title>",vbCR + vbLF +"</title>")
strInput = Replace(strInput, "<description>",vbCR + vbLF +"<description>")
strInput = Replace(strInput, "</description>",vbCR + vbLF +"</description>")
strInput = Replace(strInput, "<link>","<link>//")
dim regEx
set regEx = new RegExp
regEx.Pattern = "<([^>]|\n)*>"
regEx.IgnoreCase = true
regEx.Global = true
StripHTML = regEx.Replace(strInput, "")
end function