Fileaze banner

 

VBScript Scripting Techniques > Internet > Read Version Numbers

Read the Latest Version Number from a Web Page

 

WinHTTP (Foxit Reader)
VBScript Code:
WScript.Echo "Latest version of Foxit Reader: " & GetFoxitReaderVersion( )


Function GetFoxitReaderVersion( )
' This function returns the latest Foxit Reader
' version as string by reading Foxit'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 Foxit's download page
    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
    objHTTP.Open "GET", "http://www.foxitsoftware.com/pdf/reader_2/down_reader.htm", 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 = "Foxit Reader ([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
    GetFoxitReaderVersion = strVersion
End Function
Requirements:
Windows version: 2000 SP3, XP, Server 2003, or Vista
Network: any
Client software: Internet Explorer 5.01
Script Engine: any
Summarized: Works in Windows 2000 SP3 or later.
Should work in Windows 95, 98, ME, or NT 4 with Internet Explorer 5.01 or later.
 
[Back to the top of this page]
 
WinHTTP (VBSEdit)
VBScript Code:
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
Requirements:
Windows version: 2000 SP3, XP, Server 2003, or Vista
Network: any
Client software: Internet Explorer 5.01
Script Engine: any
Summarized: Works in Windows 2000 SP3 or later.
Should work in Windows 95, 98, ME, or NT 4 with Internet Explorer 5.01 or later.
 
[Back to the top of this page]
 
WinHTTP (Revo Uninstaller)
VBScript Code:
WScript.Echo "Latest version of Revo Uninstaller: " & GetRevoVersion( )


Function GetRevoVersion( )
' This function returns the latest Revo Uninstaller
' version as string by reading Revo'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 Revo's download page
    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
    objHTTP.Open "GET", "http://www.revouninstaller.com/revo_uninstaller_free_download.html", 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 = "Current 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
    GetRevoVersion = strVersion
End Function
Requirements:
Windows version: 2000 SP3, XP, Server 2003, or Vista
Network: any
Client software: Internet Explorer 5.01
Script Engine: any
Summarized: Works in Windows 2000 SP3 or later.
Should work in Windows 95, 98, ME, or NT 4 with Internet Explorer 5.01 or later.
 
[Back to the top of this page]

 

 


page last uploaded: 4 March 2011, 12:56