Francesco Posted August 10, 2012 Posted August 10, 2012 In WMI.js replacefunction getOSver(){ position="wmi.js"; whatfunc="getOSver()"; if (szOSVerCache==NOT_FOUND) // this function is called often - get it once and cache the result { var Caption; try { objWMIService=GetObject("winmgmts:\\\\" + "." + "\\root\\CIMV2"); colItems=objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); enumItems=new Enumerator(colItems); objItem=enumItems.item(); Caption=objItem.Caption;/*alert("BuildNumber="+objItem.BuildNumber+"\n"+ "BuildType="+objItem.BuildType+"\n"+ "Caption="+objItem.Caption+"\n"+ "OperatingSystemSKU="+objItem.OperatingSystemSKU+"\n"+ "ProductType="+objItem.ProductType+"\n"+ "Version="+objItem.Version);*/ if (Caption.indexOf("Windows 7") != -1) // Still waiting for official name szOSVerCache="Win7"; if (Caption.indexOf("2008") != -1) szOSVerCache="08"; if (Caption.indexOf("Vista") != -1) szOSVerCache="Vista"; if (Caption.indexOf("2003") != -1) szOSVerCache="03"; if (Caption.indexOf("XP") != -1) szOSVerCache="XP"; if (Caption.indexOf("2000") != -1) szOSVerCache="2K"; } catch(ex) { try { ver=WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\CurrentVersion"); } catch(ex1) { try { ver=WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Version"); } catch(ex2) { ; } } if (ver=="5.0") szOSVerCache="2K"; if (ver=="4.0") szOSVerCache="NT"; if (ver=="Windows 98") szOSVerCache="98"; if (ver=="Windows Millennium Edition") szOSVerCache="ME"; if (ver=="Windows 95") szOSVerCache="95"; } } return szOSVerCache;}withfunction getOSvernum(){ try { return WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\CurrentVersion"); } catch(ex1) { } return NOT_FOUND;}function getOSver(){ position="wmi.js"; whatfunc="getOSver()"; if (szOSVerCache==NOT_FOUND) // this function is called often - get it once and cache the result { try { objWMIService=GetObject("winmgmts:\\\\" + "." + "\\root\\CIMV2"); colItems=objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); enumItems=new Enumerator(colItems); objItem=enumItems.item(); var Caption=objItem.Caption; if (Caption.indexOf("Windows 8") != -1) szOSVerCache="Win8"; if (Caption.indexOf("Windows 7") != -1) szOSVerCache="Win7"; if (Caption.indexOf("2008") != -1) szOSVerCache="08"; if (Caption.indexOf("Vista") != -1) szOSVerCache="Vista"; if (Caption.indexOf("2003") != -1) szOSVerCache="03"; if (Caption.indexOf("XP") != -1) szOSVerCache="XP"; if (Caption.indexOf("2000") != -1) szOSVerCache="2K"; } catch(ex) { } } return szOSVerCache;}In configwizard.js replace ConditionsMenuBar.addNewChild("cond_architecture_os", 0, "architecture_getOSver", "getOSver()", false, "", ""); ConditionsMenuBar.addNewChild("cond_architecture_os", 1, "architecture_getSPver", "getSPver()", false, "", ""); ConditionsMenuBar.addNewChild("cond_architecture_os", 2, "architecture_getOSlang", "getOSlang()", false, "", ""); ConditionsMenuBar.addNewChild("cond_architecture_os", 3, "architecture_getOSlocale", "getOSlocale()", false, "", "");with ConditionsMenuBar.addNewChild("cond_architecture_os", 0, "architecture_getOSver", "getOSver()", false, "", ""); ConditionsMenuBar.addNewChild("cond_architecture_os", 1, "architecture_getOSvernum", "getOSvernum()", false, "", ""); ConditionsMenuBar.addNewChild("cond_architecture_os", 2, "architecture_getSPver", "getSPver()", false, "", ""); ConditionsMenuBar.addNewChild("cond_architecture_os", 3, "architecture_getOSlang", "getOSlang()", false, "", ""); ConditionsMenuBar.addNewChild("cond_architecture_os", 4, "architecture_getOSlocale", "getOSlocale()", false, "", "");and replace GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 0, "architecture_getOSver", "getOSver()", false, "", ""); GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 1, "architecture_getSPver", "getSPver()", false, "", ""); GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 2, "architecture_getOSlang", "getOSlang()", false, "", ""); GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 3, "architecture_getOSlocale", "getOSlocale()", false, "", "");with GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 0, "architecture_getOSver", "getOSver()", false, "", ""); GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 1, "architecture_getOSvernum", "getOSvernum()", false, "", ""); GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 2, "architecture_getSPver", "getSPver()", false, "", ""); GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 3, "architecture_getOSlang", "getOSlang()", false, "", ""); GrayedConditionsMenuBar.addNewChild("gcond_architecture_os", 4, "architecture_getOSlocale", "getOSlocale()", false, "", "");and add below case 'architecture_getOSver': HandleConditionsSelectionMenu(!InsertCondValues ? "getOSver()" : 'getOSver()=="'+getOSver()+'"'); break;this code case 'architecture_getOSvernum': HandleConditionsSelectionMenu(!InsertCondValues ? "getOSvernum()" : 'getOSvernum()=="'+getOSvernum()+'"'); break;
Recommended Posts