clear #define WSH_2K "Windows Script 5.6 for Windows 2000 scripten.exe" #define WSH_ME "Windows Script 5.6 for Windows 98, Windows Millennium Edition and Windows NT 4.0 scr56en.exe" ? "Check for an install if needed windows scripting host" ScriptingOK = false vbscript = getWinSysFolder()+"\vbscript.dll" jscript = getWinSysFolder()+"\jscript.dll" if new file().exists(vbscript) and ; new file().exists(jscript) if val(getFileVersion(vbscript)) < 5.6 or ; val(getFileVersion(jscript)) < 5.5 ? "Install WSH 5.6 - Old Version Installed" ScriptingOK = false else ? "WSH 5.6 OK" ScriptingOK = true endif else ? "Install WSH 5.6 - Not Installed" ScriptingOK = false endif if ScriptingOK try // now try to run it WshShell = new OleAutoClient("Wscript.shell") release object WshShell WshShell = NULL ? "Passed Shell Test" catch(exception e) ScriptingOK = false ? "Failed Shell Test" endtry endif // ok, if we are still false, install it. if not ScriptingOK if isWin2K() run(true,WSH_2K+" /q") elseif isWinXP() // XP Should has it already. So if we are here... msgbox("Windows XP Scripting Host Had An Error","Error!",16) else run(true,WSH_ME+" /q") endif endif return function isWin2K return "5.00"$ os() and ("NT"$ os() or "2K"# os()) function isWinXP return "5.01"$ os() and ("NT"$ os() or "XP"$ os()) function getFileVersion parameter cFilePath local c,sReturnString,iVersionSize,sBuffer,iStart,isNull sReturnString = new string() if type('GetFileVersionInfoSizeA') # 'FP' extern CINT GetFileVersionInfoSizeA(CSTRING, CPTR CINT) version endif if type('GetFileVersionInfoA') # 'FP' extern CINT GetFileVersionInfoA(CSTRING, CINT, CINT, CPTR) version endif iVersionSize = GetFileVersionInfoSizeA(cFilePath,0) sBuffer = new string(space(iVersionSize)+1) GetFileVersionInfoA(cFilePath,0,iVersionSize,sBuffer) iStart = at("FileVersion",sBuffer) if empty(iStart) sReturnString = "Error" else iStart += 12 isNull = false do while not isNull c = sBuffer.CharAt(iStart) if ( ASC(c) = 0 or iStart > 1024 ) isNull = true else sReturnString += c endif iStart++ enddo endif return sReturnString function getWinSysFolder nlen = 260; s = space(nlen) If Type("WinAPIGetSystemDirectory") # "FP" extern CWORD WinAPIGetSystemDirectory (CSTRING, CWORD) ; KERNEL32 from "GetSystemDirectoryA" endif nlen = WinAPIGetSystemDirectory(s,nlen) return left(s,nlen)