(view source code of foxitver.vbs as plain text)
Option Explicit
If WScript.Arguments.Count > 0 Then Syntax
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
Sub Syntax
Dim strMsg
strMsg = "FoxitVer.vbs, Version 2.00" _
& vbCrLf _
& "Read the latest available version of Foxit Reader from its version history page" _
& vbCrLf & vbCrLf _
& "Usage : FOXITVER.VBS" _
& vbCrLf & vbCrLf
strMsg = strMsg & "Returns: " & GetFoxitReaderVersion( ) & vbCrLf & vbCrLf
strMsg = strMsg _
& "Note : This is a demo script, hardcoded for Foxit Reader." _
& 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.0071 seconds