home *** CD-ROM | disk | FTP | other *** search
- '--------------------------------------------------------------------------
- ' ReportIEVersion.vbs - Reports version of the Internet Explorer files
- '
- ' This file is part of the sgVersionInfo.
- ' Copyright (C) 1998 Stinga
- ' All rights reserved.
- '
- ' This source code demonstrates usage of the sgVersionInfo component.
- ' and it's numeric properties.
- '--------------------------------------------------------------------------
-
- ' Create some objects
- set VerInfo = WScript.CreateObject("sgVersionInfo.VersionInfo")
- Set fs = WScript.CreateObject("Scripting.FileSystemObject")
- Set wsh = WScript.CreateObject("WScript.shell")
- Set ie = WScript.CreateObject("InternetExplorer.Application")
-
- On Error Resume Next
- Dim sMsg
- Dim vbCrLf
- vbCrLf = Chr(13) + Chr(10)
-
- ' Are we running from command line?
- Dim bFromCmdLine
- bFromCmdLine = false
- if InStrRev(UCase(WScript.FullName), "CSCRIPT") then bFromCmdLine = true
-
- ' Get system folder
- 'Dim sSystemFolder
- 'Set sSystemFolder = wsh.Environment("Process")("WINDIR")
-
-
- ' Collect info ...
- sMsg = GetInfo("EXPLORER.EXE")
- sMsg = sMsg + GetInfo("SHDOCVW.DLL")
- sMsg = sMsg + GetInfo("MSHTML.DLL")
- sMsg = sMsg + GetInfo("URLMON.DLL")
- sMsg = sMsg + GetInfo("URL.DLL")
-
- ' ... and display it
- if bFromCmdLine then
- WScript.Echo sMsg, "SG VersionInfo Example"
- else
- MsgBox sMsg
- end if
-
- set VerInfo = Nothing
- Set fs = Nothing
- Set ie = Nothing
- WScript.Quit(0)
-
-
- '--------------------------------------------------------------------------
- ' Collect info for specified file and return it in the string variable
- '--------------------------------------------------------------------------
- Private Function GetInfo(path)
- On Error Resume Next
- GetInfo = ""
-
- ' Try to get version info for current file
- VerInfo.Path = path
- if Err.Number = 0 then
- ' No error. Collect version info if file contains any
- if VerInfo.InfoExist then
- GetInfo = VerInfo.FileDescription + " (" + path + ")" + vbCrLf
- GetInfo = GetInfo + "File Version:" + Chr(9)
- GetInfo = GetInfo + CStr(VerInfo.FileVersionHigh \ 65536) + "."
- GetInfo = GetInfo + CStr(VerInfo.FileVersionHigh Mod 65536) + "."
- GetInfo = GetInfo + CStr(VerInfo.FileVersionLow \ 65536) + "."
- GetInfo = GetInfo + CStr(VerInfo.FileVersionLow Mod 65536) + vbCrLf
- GetInfo = GetInfo + "Product Version:" + Chr(9)
- GetInfo = GetInfo + CStr(VerInfo.ProductVersionHigh \ 65536) + "."
- GetInfo = GetInfo + CStr(VerInfo.ProductVersionHigh Mod 65536) + "."
- GetInfo = GetInfo + CStr(VerInfo.ProductVersionLow \ 65536) + "."
- GetInfo = GetInfo + CStr(VerInfo.ProductVersionLow Mod 65536) + vbCrLf + vbCrLf
- end if
- else
- ' Somethig went wrong
- GetInfo = file.Name + ": " + Err.Decription + vbCrLf
- Err.Clear
- end if
- End Function
-