(view source code of vbsedver.vbs as plain text)
Option Explicit
If WScript.Arguments.Count > 0 Then Syntax
WScript.Echo "Latest version of VBSEdit: " & GetVBSEditVersion( )
Function GetVBSEditVersion( )
' This function returns the latest VBSEdit version
' as string by reading Adersoft's download page.
' If an error occurs, the returned version will be "0".
' Written by Rob van der Woude
' http://www.robvanderwoude.com
Dim objHTTP, objMatch, objRE, strHTML, strUserAgent, strVersion
' Initial return string, in case an error occurs
strVersion = "0"
' Use WinHTTP to read the text from Adersoft's download page
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
objHTTP.Open "GET", "http://www.vbsedit.com/", False
strUserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"
objHTTP.SetRequestHeader "UserAgent", strUserAgent
objHTTP.Send
If objHTTP.Status = 200 Then
' If the page was returned, use a regular expression
' to extract Foxit Reader's current version number
strHTML = objHTTP.ResponseText
Set objRE = New RegExp
objRE.Pattern = "Version ([0-9]+(\.[0-9]+)+)"
objRE.IgnoreCase = False
objRE.Global = True
Set objMatch = objRE.Execute( strHTML )
If objMatch.Count > 0 Then
strVersion = objMatch.Item(0).Submatches.Item(0)
End If
Set objMatch = Nothing
Set objRE = Nothing
End If
Set objHTTP = Nothing
' Return the result
GetVBSEditVersion = strVersion
End Function
Sub Syntax
Dim strMsg
strMsg = "VBSEdVer.vbs, Version 1.01" _
& vbCrLf _
& "Read the latest available version of VBSEdit from its download page" _
& vbCrLf & vbCrLf _
& "Usage : VBSEDVER.VBS" _
& vbCrLf & vbCrLf
strMsg = strMsg & "Returns: " & GetVBSEditVersion( ) & vbCrLf & vbCrLf
strMsg = strMsg _
& "Note : This is a demo script, hardcoded for VBSEdit." _
& vbCrLf _
& " You are encouraged to modify the code to your own requirements." _
& vbCrLf & vbCrLf _
& "Written by Rob van der Woude" _
& vbCrLf _
& "http://www.robvanderwoude.com"
WScript.Echo strMsg
WScript.Quit 1
End Sub
page last modified: 2024-04-16; loaded in 0.0073 seconds