(view source code of orin.vbs as plain text)
' =============================================' == Modify the following 3 variables: ==' =============================================' Specify the URL and the output file's destination directorystrURL = "http://www.orindaben.com/db/dbmeditation/meditation.php"
strDir = "C:\My Documents\"
' The current week number will be appended to the file name specified herestrFilePrefix = "Orin and DaBen meditation for week "
' =============================================' == Modify the 3 variables above this line! ==' =============================================' Check for command line arguments (none required)If WScript.Arguments.Count Then Syntax
' Use our own error handlingOn Error Resume Next
' Retrieve text from specified URLstrText = TextFromHTML( strURL )
' Get week number and append it to text file namenumWeek = DatePart( "ww", Date,vbSunday,vbFirstFourDays )
strFile = strDir & strFilePrefix & numWeek & ".txt"
' Create a new text fileSet fso = CreateObject( "Scripting.FileSystemObject" )
Set fileHandle = fso.CreateTextFile( strFile, True )
' Write the retrieved text to the new filefileHandle.Write strText
' Close the filefileHandle.Close
' Use default text editor to display text read from URLSet wshShell = CreateObject( "WScript.Shell" )
If Err Then ShowErr
wshShell.Run( Quoted( strFile ) )
If Err Then ShowErr
' Normal program terminationWScript.Echo 0
Sub ShowErrstrMsg = "Error # " & Err.Number & vbCrLf _
& Err.Description & vbCrLf & vbCrLf
WScript.Echo strMsg
End Sub
' TextFromHTML() function by Rube Goldberg' http://dev.remotenetworktechnology.com/wsh/rubegoldberg.htmFunction TextFromHTML( URL )
Set objIE = CreateObject( "InternetExplorer.Application" )
If Err Then ShowErr
objIE.Navigate URL
If Err Then ShowErr
Do Until objIE.ReadyState = 4
WScript.Sleep 10
LoopTextFromHTML = objIE.Document.Body.InnerText
If Err Then ShowErr
objIE.Quit
End Function
Function Quoted( str )
Quoted = Chr(34) & str & Chr(34)
End Function
Sub Syntax strMsg = vbCrLf _& "Orin.vbs, Version 1.00" & vbCrLf _
& "Retrieve text from a URL and store it in a text file" & vbCrLf _
& "with the week number appended to its file name." _
& vbCrLf & vbCrLf _
& "Usage: CSCRIPT ORIN.VBS" _
& vbCrLf & vbCrLf _
& "I wrote this script for my wife, so she can automatically retrieve the" & vbCrLf _
& "text for a weekly meditation by Orin and DaBen and store it for later use." & vbCrLf _
& "That is why the week number is appended to the destination file name." & vbCrLf _
& "The URL and the destination of the text are hard coded into this script." & vbCrLf _
& "Adapt them to your own needs." _
& vbCrLf & vbCrLf _
& "The function to retrieve text from a URL was written by Rube Goldberg" & vbCrLf _
& "http://dev.remotenetworktechnology.com/wsh/rubegoldberg.htm" _
& vbCrLf & vbCrLf _
& "Written by Rob van der Woude" & vbCrLf _
& "http://www.robvanderwoude.com"
WScript.Echo strMsg
Wscript.Quit 1
End Sub
page last modified: 2025-10-11; loaded in 0.0060 seconds