Rob van der Woude's Scripting Pages

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 current Foxit Reader version
' as string by reading Foxit's version history 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
    GetFoxitReaderVersion = "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
    objHTTP.Open "GET", "http://www.foxitsoftware.com/Secure_PDF_Reader/version_history.php", 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 latest version number
        strHTML = objHTTP.ResponseText
        Set objRE = New RegExp
        objRE.Pattern = "<h[ˆ>]+>Version History</h\d+>[\n\r\s]+<h[ˆ>]+>What's New in Foxit Reader (\d+\.\d+\.\d+)</h\d+>"
        objRE.IgnoreCase = False
        objRE.Global = False
        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 Freeware : " & GetRevoVersion( "Free" )
WScript.Echo "Latest version of Revo Uninstaller Pro      : " & GetRevoVersion( "Pro"  )


Function GetRevoVersion( myType )
' This function returns the latest Revo Uninstaller (Free/Pro)
' version as string by reading Revo's version history pages.
' 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" )
    If UCase( myType ) = "PRO" Then
        objHTTP.Open "GET", "http://www.revouninstaller.com/revo_uninstaller_pro_full_version_history.html", False
    Else
        objHTTP.Open "GET", "http://www.revouninstaller.com/revo_uninstaller_full_version_history.html", False
    End If
    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
        If UCase( myType ) = "PRO" Then
            objRE.Pattern = "Revo Uninstaller Pro version (\d+\.\d+(\.\d+)?)"
        Else
            objRE.Pattern = "Revo Uninstaller Freeware version (\d+\.\d+(\.\d+)?)"
        End If
        objRE.IgnoreCase = False
        objRE.Global = False
        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 modified: 2016-09-19; loaded in 0.0014 seconds