Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for revo_ver.vbs

(view source code of revo_ver.vbs as plain text)

  1. Option Explicit
  2.  
  3. WScript.Echo "Latest version of Revo Uninstaller Freeware : " & GetRevoVersion( "Free" )
  4. WScript.Echo "Latest version of Revo Uninstaller Pro      : " & GetRevoVersion( "Pro"  )
  5.  
  6.  
  7. Function GetRevoVersion( myType )
  8. ' This function returns the latest Revo Uninstaller (Free/Pro)
  9. ' version as string by reading Revo's version history pages.
  10. ' If an error occurs, the returned version will be "0".
  11. ' Written by Rob van der Woude
  12. ' http://www.robvanderwoude.com
  13. 	Dim objHTTP, objMatch, objRE, strHTML, strUserAgent, strVersion
  14. 	' Initial return string, in case an error occurs
  15. 	strVersion = "0"
  16. 	' Use WinHTTP to read the text from Revo's download page
  17. 	Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
  18. 	If UCase( myType ) = "PRO" Then
  19. 		objHTTP.Open "GET", "http://www.revouninstaller.com/revo_uninstaller_pro_full_version_history.html", False
  20. 	Else
  21. 		objHTTP.Open "GET", "http://www.revouninstaller.com/revo_uninstaller_full_version_history.html", False
  22. 	End If
  23. 	strUserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3"
  24. 	objHTTP.SetRequestHeader "UserAgent", strUserAgent
  25. 	objHTTP.Send
  26. 	If objHTTP.Status = 200 Then
  27. 		' If the page was returned, use a regular expression
  28. 		' to extract Foxit Reader's current version number
  29. 		strHTML = objHTTP.ResponseText
  30. 		Set objRE = New RegExp
  31. 		If UCase( myType ) = "PRO" Then
  32. 			objRE.Pattern = "Revo Uninstaller Pro version (\d+\.\d+(\.\d+)?)"
  33. 		Else
  34. 			objRE.Pattern = "Revo Uninstaller Freeware version (\d+\.\d+(\.\d+)?)"
  35. 		End If
  36. 		objRE.IgnoreCase = False
  37. 		objRE.Global = False
  38. 		Set objMatch = objRE.Execute( strHTML )
  39. 		If objMatch.Count > 0 Then
  40. 			strVersion = objMatch.Item(0).Submatches.Item(0)
  41. 		End If
  42. 		Set objMatch = Nothing
  43. 		Set objRE = Nothing
  44. 	End If
  45. 	Set objHTTP = Nothing
  46. 	' Return the result
  47. 	GetRevoVersion = strVersion
  48. End Function
  49.  

page last uploaded: 2017-08-21, 14:26